1
0
mirror of https://github.com/flarum/core.git synced 2025-08-09 09:57:06 +02:00

Convert subscriber to listener, eliminating compat-style extender

This commit is contained in:
Alexander Skvortsov
2020-12-08 11:11:54 -05:00
parent 99e73a38a9
commit a9e729401b
2 changed files with 5 additions and 16 deletions

View File

@@ -16,8 +16,9 @@ use Flarum\Likes\Event\PostWasUnliked;
use Flarum\Likes\Listener;
use Flarum\Likes\Notification\PostLikedBlueprint;
use Flarum\Post\Post;
use Flarum\Post\Event\Deleted;
use Flarum\Post\Event\Saving;
use Flarum\User\User;
use Illuminate\Contracts\Events\Dispatcher;
return [
(new Extend\Frontend('forum'))
@@ -55,9 +56,7 @@ return [
(new Extend\Event())
->listen(PostWasLiked::class, Listener\SendNotificationWhenPostIsLiked::class)
->listen(PostWasUnliked::class, Listener\SendNotificationWhenPostIsUnliked::class),
function (Dispatcher $events) {
$events->subscribe(Listener\SaveLikesToDatabase::class);
},
->listen(PostWasUnliked::class, Listener\SendNotificationWhenPostIsUnliked::class)
->listen(Deleted::class, [Listener\SaveLikesToDatabase::class, 'whenPostIsDeleted'])
->listen(Saving::class, [Listener\SaveLikesToDatabase::class, 'whenPostIsSaving']),
];