From 3dcd356edc0ca7cc203b8c207cbf75fb581c9817 Mon Sep 17 00:00:00 2001 From: Sami Mazouz Date: Sat, 31 Oct 2020 23:42:01 +0100 Subject: [PATCH] Use the new Notification type extender (#29) --- extensions/suspend/extend.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/extensions/suspend/extend.php b/extensions/suspend/extend.php index c2e454269..eba4ede5c 100644 --- a/extensions/suspend/extend.php +++ b/extensions/suspend/extend.php @@ -8,7 +8,6 @@ */ use Flarum\Api\Serializer\BasicUserSerializer; -use Flarum\Event\ConfigureNotificationTypes; use Flarum\Event\ConfigureUserGambits; use Flarum\Extend; use Flarum\Suspend\Access; @@ -36,16 +35,16 @@ return [ new Extend\Locales(__DIR__.'/locale'), + (new Extend\Notification()) + ->type(UserSuspendedBlueprint::class, BasicUserSerializer::class, ['alert', 'email']) + ->type(UserUnsuspendedBlueprint::class, BasicUserSerializer::class, ['alert', 'email']), + function (Dispatcher $events) { $events->subscribe(Listener\AddUserSuspendAttributes::class); $events->subscribe(Listener\RevokeAccessFromSuspendedUsers::class); $events->listen(Saving::class, Listener\SaveSuspensionToDatabase::class); - $events->listen(ConfigureNotificationTypes::class, function (ConfigureNotificationTypes $event) { - $event->add(UserSuspendedBlueprint::class, BasicUserSerializer::class, ['alert', 'email']); - $event->add(UserUnsuspendedBlueprint::class, BasicUserSerializer::class, ['alert', 'email']); - }); $events->listen(Suspended::class, Listener\SendNotificationWhenUserIsSuspended::class); $events->listen(Unsuspended::class, Listener\SendNotificationWhenUserIsUnsuspended::class);