js(__DIR__.'/js/dist/forum.js') ->css(__DIR__.'/less/forum.less'), (new Extend\Frontend('admin')) ->js(__DIR__.'/js/dist/admin.js'), new Extend\Locales(__DIR__.'/locale'), (new Extend\Notification()) ->type(DiscussionLockedBlueprint::class, BasicDiscussionSerializer::class, ['alert']), (new Extend\ApiSerializer(DiscussionSerializer::class)) ->attribute('isLocked', function (DiscussionSerializer $serializer, Discussion $discussion) { return (bool) $discussion->is_locked; }) ->attribute('canLock', function (DiscussionSerializer $serializer, Discussion $discussion) { return (bool) $serializer->getActor()->can('lock', $discussion); }), (new Extend\Post()) ->type(DiscussionLockedPost::class), (new Extend\Event()) ->listen(Saving::class, Listener\SaveLockedToDatabase::class) ->listen(DiscussionWasLocked::class, Listener\CreatePostWhenDiscussionIsLocked::class) ->listen(DiscussionWasUnlocked::class, Listener\CreatePostWhenDiscussionIsUnlocked::class), (new Extend\Policy()) ->modelPolicy(Discussion::class, Access\DiscussionPolicy::class), (new Extend\Filter(DiscussionFilterer::class)) ->addFilter(LockedFilterGambit::class), (new Extend\SimpleFlarumSearch(DiscussionSearcher::class)) ->addGambit(LockedFilterGambit::class), ];