fix: load event mentioned tags on show discussion endpoint (#3915)

This commit is contained in:
Sami Mazouz 2023-11-01 14:43:00 +01:00 committed by GitHub
parent a3192d2934
commit 5cdfa0f640
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -177,10 +177,14 @@ return [
(new Extend\ApiController(FlarumController\ListPostsController::class))
->addInclude('eventPostMentionsTags')
// Restricted tags should still appear as `deleted` to unauthorized users.
->loadWhere('eventPostMentionsTags', function (Relation|Builder $query, ?ServerRequestInterface $request) {
->loadWhere('eventPostMentionsTags', $restrictMentionedTags = function (Relation|Builder $query, ?ServerRequestInterface $request) {
if ($request) {
$actor = RequestUtil::getActor($request);
$query->whereVisibleTo($actor);
}
}),
(new Extend\ApiController(FlarumController\ShowDiscussionController::class))
->addInclude('posts.eventPostMentionsTags')
->loadWhere('posts.eventPostMentionsTags', $restrictMentionedTags),
];