Skip to content

Commit

Permalink
test: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
SychO9 committed Sep 27, 2024
1 parent 04ad7a8 commit a784c33
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion extensions/mentions/src/Api/PostResourceFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

namespace Flarum\Mentions\Api;

use Flarum\Api\Context;
use Flarum\Api\Schema;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;

class PostResourceFields
Expand All @@ -20,7 +22,9 @@ public function __invoke(): array
{
return [
Schema\Integer::make('mentionedByCount')
->countRelation('mentionedBy'),
->countRelation('mentionedBy', function (Builder $query, Context $context) {
$query->whereVisibleTo($context->getActor());
}),

Schema\Relationship\ToMany::make('mentionedBy')
->type('posts')
Expand Down

0 comments on commit a784c33

Please sign in to comment.