diff --git a/extensions/mentions/extend.php b/extensions/mentions/extend.php index 814e4efef2..ef19a68a06 100644 --- a/extensions/mentions/extend.php +++ b/extensions/mentions/extend.php @@ -26,6 +26,7 @@ use Flarum\Post\Event\Revised; use Flarum\Post\Filter\PostFilterer; use Flarum\Post\Post; +use Flarum\Tags\Api\Serializer\TagSerializer; use Flarum\User\User; return [ @@ -124,5 +125,23 @@ // Tag mentions (new Extend\Conditional()) - ->whenExtensionEnabled('flarum-tags', TagExtender::class), + ->whenExtensionEnabled('flarum-tags', fn () => [ + (new Extend\Formatter) + ->render(Formatter\FormatTagMentions::class) + ->unparse(Formatter\UnparseTagMentions::class), + + (new Extend\ApiSerializer(BasicPostSerializer::class)) + ->hasMany('mentionsTags', TagSerializer::class), + + (new Extend\ApiController(Controller\ShowDiscussionController::class)) + ->load(['posts.mentionsTags']), + + (new Extend\ApiController(Controller\ListDiscussionsController::class)) + ->load([ + 'firstPost.mentionsTags', 'lastPost.mentionsTags', + ]), + + (new Extend\ApiController(Controller\ListPostsController::class)) + ->load(['mentionsTags']), + ]), ]; diff --git a/extensions/mentions/src/TagExtender.php b/extensions/mentions/src/TagExtender.php deleted file mode 100644 index d32fe60f58..0000000000 --- a/extensions/mentions/src/TagExtender.php +++ /dev/null @@ -1,41 +0,0 @@ -render(Formatter\FormatTagMentions::class) - ->unparse(Formatter\UnparseTagMentions::class), - - (new Extend\ApiSerializer(BasicPostSerializer::class)) - ->hasMany('mentionsTags', TagSerializer::class), - - (new Extend\ApiController(Controller\ShowDiscussionController::class)) - ->load(['posts.mentionsTags']), - - (new Extend\ApiController(Controller\ListDiscussionsController::class)) - ->load([ - 'firstPost.mentionsTags', 'lastPost.mentionsTags', - ]), - - (new Extend\ApiController(Controller\ListPostsController::class)) - ->load(['mentionsTags']), - ]; - } -}