Skip to content

Commit

Permalink
Use the new Notification type extender (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
SychO9 committed Oct 31, 2020
1 parent 9124537 commit 9b305a2
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions extend.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/

use Flarum\Api\Serializer\BasicUserSerializer;
use Flarum\Event\ConfigureNotificationTypes;
use Flarum\Event\ConfigureUserGambits;
use Flarum\Extend;
use Flarum\Suspend\Access;
Expand Down Expand Up @@ -36,16 +35,16 @@

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

Expand Down

0 comments on commit 9b305a2

Please sign in to comment.