Use Routes extender

This commit is contained in:
Franz Liedke 2018-02-08 18:30:00 +01:00
parent 99c172b2b4
commit 4daec37f78
2 changed files with 3 additions and 10 deletions

View File

@ -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);

View File

@ -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');
}
}