diff --git a/src/Entity/Actor.php b/src/Entity/Actor.php index be1babeba0..9d1c92cb6f 100644 --- a/src/Entity/Actor.php +++ b/src/Entity/Actor.php @@ -292,44 +292,49 @@ class Actor extends Entity if (\is_null($scoped)) { return Cache::get( "othertags-{$this->getId()}", - fn () => (($t = DB::dql( - <<< 'EOQ' - SELECT circle, tag - FROM actor_tag tag - JOIN actor_circle circle - WITH tag.tagger = circle.tagger - AND tag.tag = circle.tag - WHERE tag.tagged = :id - ORDER BY tag.modified DESC, tag.tagged DESC - EOQ, - ['id' => $this->getId()], - options: ['offset' => $offset, 'limit' => $limit], - )) === [] ? [[],[]] : $t), + fn () => F\partition( + DB::dql( + <<< 'EOQ' + SELECT circle, tag + FROM actor_tag tag + JOIN actor_circle circle + WITH tag.tagger = circle.tagger + AND tag.tag = circle.tag + WHERE tag.tagged = :id + ORDER BY tag.modified DESC, tag.tagged DESC + EOQ, + ['id' => $this->getId()], + options: ['offset' => $offset, 'limit' => $limit], + ), + fn ($o) => $o instanceof ActorCircle, + ), ); } else { $scoped_id = \is_int($scoped) ? $scoped : $scoped->getId(); return Cache::get( "othertags-{$this->getId()}-by-{$scoped_id}", - fn () => (($t = DB::dql( - <<< 'EOQ' - SELECT circle, tag - FROM actor_tag tag - JOIN actor_circle circle - WITH - tag.tagger = circle.tagger - AND tag.tag = circle.tag - WHERE - tag.tagged = :id - AND (circle.private != true - OR (circle.tagger = :scoped - AND circle.private = true - ) - ) - ORDER BY tag.modified DESC, tag.tagged DESC - EOQ, - ['id' => $this->getId(), 'scoped' => $scoped_id], - options: ['offset' => $offset, 'limit' => $limit], - )) === [] ? [[],[]] : $t), + fn () => F\partition( + DB::dql( + <<< 'EOQ' + SELECT circle, tag + FROM actor_tag tag + JOIN actor_circle circle + WITH tag.tagger = circle.tagger + AND tag.tag = circle.tag + WHERE + tag.tagged = :id + AND (circle.private != true + OR (circle.tagger = :scoped + AND circle.private = true + ) + ) + ORDER BY tag.modified DESC, tag.tagged DESC + EOQ, + ['id' => $this->getId(), 'scoped' => $scoped_id], + options: ['offset' => $offset, 'limit' => $limit], + ), + fn ($o) => $o instanceof ActorCircle, + ), ); } }