From 4daec37f78f2ed7cc0ec7c8860e991c7e082567a Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Thu, 8 Feb 2018 18:30:00 +0100 Subject: [PATCH] Use Routes extender --- extensions/subscriptions/bootstrap.php | 3 +++ .../Listener/FilterDiscussionListBySubscription.php | 10 ---------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/extensions/subscriptions/bootstrap.php b/extensions/subscriptions/bootstrap.php index da0b778d3..e819bd95b 100644 --- a/extensions/subscriptions/bootstrap.php +++ b/extensions/subscriptions/bootstrap.php @@ -10,6 +10,7 @@ */ use Flarum\Extend; +use Flarum\Forum\Controller\FrontendController; use Flarum\Subscriptions\Listener; use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Contracts\View\Factory; @@ -19,6 +20,8 @@ return [ ->asset(__DIR__.'/js/forum/dist/extension.js') ->asset(__DIR__.'/less/forum/extension.less') ->bootstrapper('flarum/subscriptions/main'), + (new Extend\Routes('forum')) + ->get('/following', 'following', FrontendController::class), function (Dispatcher $events, Factory $views) { $events->subscribe(Listener\AddDiscussionSubscriptionAttribute::class); $events->subscribe(Listener\FilterDiscussionListBySubscription::class); diff --git a/extensions/subscriptions/src/Listener/FilterDiscussionListBySubscription.php b/extensions/subscriptions/src/Listener/FilterDiscussionListBySubscription.php index c5bfdc224..60dc30dfd 100755 --- a/extensions/subscriptions/src/Listener/FilterDiscussionListBySubscription.php +++ b/extensions/subscriptions/src/Listener/FilterDiscussionListBySubscription.php @@ -13,7 +13,6 @@ namespace Flarum\Subscriptions\Listener; use Flarum\Discussion\Event\Searching; use Flarum\Event\ConfigureDiscussionGambits; -use Flarum\Event\ConfigureForumRoutes; use Flarum\Subscriptions\Gambit\SubscriptionGambit; use Illuminate\Contracts\Events\Dispatcher; @@ -26,7 +25,6 @@ class FilterDiscussionListBySubscription { $events->listen(ConfigureDiscussionGambits::class, [$this, 'addGambit']); $events->listen(Searching::class, [$this, 'filterIgnored']); - $events->listen(ConfigureForumRoutes::class, [$this, 'addRoutes']); } /** @@ -54,12 +52,4 @@ class FilterDiscussionListBySubscription }); } } - - /** - * @param ConfigureForumRoutes $event - */ - public function addRoutes(ConfigureForumRoutes $event) - { - $event->get('/following', 'following'); - } }