From ca99e9911cd3fffabfc76299a1e796c43f2773ea Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov Date: Tue, 19 Jan 2021 19:12:29 -0500 Subject: [PATCH] Remove deprecated notification events --- framework/core/src/Api/ApiServiceProvider.php | 7 --- .../src/Event/ConfigureNotificationTypes.php | 58 ------------------- .../core/src/Notification/Event/Sending.php | 42 -------------- .../NotificationServiceProvider.php | 6 -- .../src/Notification/NotificationSyncer.php | 6 -- 5 files changed, 119 deletions(-) delete mode 100644 framework/core/src/Event/ConfigureNotificationTypes.php delete mode 100644 framework/core/src/Notification/Event/Sending.php diff --git a/framework/core/src/Api/ApiServiceProvider.php b/framework/core/src/Api/ApiServiceProvider.php index 4f3cfe37b..739a44dfc 100644 --- a/framework/core/src/Api/ApiServiceProvider.php +++ b/framework/core/src/Api/ApiServiceProvider.php @@ -13,7 +13,6 @@ use Flarum\Api\Controller\AbstractSerializeController; use Flarum\Api\Serializer\AbstractSerializer; use Flarum\Api\Serializer\BasicDiscussionSerializer; use Flarum\Api\Serializer\NotificationSerializer; -use Flarum\Event\ConfigureNotificationTypes; use Flarum\Foundation\AbstractServiceProvider; use Flarum\Foundation\ErrorHandling\JsonApiFormatter; use Flarum\Foundation\ErrorHandling\Registry; @@ -122,14 +121,8 @@ class ApiServiceProvider extends AbstractServiceProvider */ protected function setNotificationSerializers() { - $blueprints = []; $serializers = $this->app->make('flarum.api.notification_serializers'); - // Deprecated in beta 15, remove in beta 16 - $this->app->make('events')->dispatch( - new ConfigureNotificationTypes($blueprints, $serializers) - ); - foreach ($serializers as $type => $serializer) { NotificationSerializer::setSubjectSerializer($type, $serializer); } diff --git a/framework/core/src/Event/ConfigureNotificationTypes.php b/framework/core/src/Event/ConfigureNotificationTypes.php deleted file mode 100644 index 89185b916..000000000 --- a/framework/core/src/Event/ConfigureNotificationTypes.php +++ /dev/null @@ -1,58 +0,0 @@ -blueprints = &$blueprints; - $this->serializers = &$serializers; - } - - /** - * @param string $blueprint - * @param string $serializer - * @param array $enabledByDefault - */ - public function add($blueprint, $serializer, $enabledByDefault = []) - { - if (! (new ReflectionClass($blueprint))->implementsInterface(BlueprintInterface::class)) { - throw new InvalidArgumentException( - 'Notification blueprint '.$blueprint.' must implement '.BlueprintInterface::class - ); - } - - $this->blueprints[$blueprint] = $enabledByDefault; - - $this->serializers[$blueprint::getType()] = $serializer; - } -} diff --git a/framework/core/src/Notification/Event/Sending.php b/framework/core/src/Notification/Event/Sending.php deleted file mode 100644 index 25858a2db..000000000 --- a/framework/core/src/Notification/Event/Sending.php +++ /dev/null @@ -1,42 +0,0 @@ -blueprint = $blueprint; - $this->users = &$users; - } -} diff --git a/framework/core/src/Notification/NotificationServiceProvider.php b/framework/core/src/Notification/NotificationServiceProvider.php index 7a169e1f6..b41be729d 100644 --- a/framework/core/src/Notification/NotificationServiceProvider.php +++ b/framework/core/src/Notification/NotificationServiceProvider.php @@ -9,7 +9,6 @@ namespace Flarum\Notification; -use Flarum\Event\ConfigureNotificationTypes; use Flarum\Foundation\AbstractServiceProvider; use Flarum\Notification\Blueprint\DiscussionRenamedBlueprint; @@ -60,11 +59,6 @@ class NotificationServiceProvider extends AbstractServiceProvider { $blueprints = $this->app->make('flarum.notification.blueprints'); - // Deprecated in beta 15, remove in beta 16 - $this->app->make('events')->dispatch( - new ConfigureNotificationTypes($blueprints) - ); - foreach ($blueprints as $blueprint => $driversEnabledByDefault) { $this->addType($blueprint, $driversEnabledByDefault); } diff --git a/framework/core/src/Notification/NotificationSyncer.php b/framework/core/src/Notification/NotificationSyncer.php index 7e7a5c4ff..22072d941 100644 --- a/framework/core/src/Notification/NotificationSyncer.php +++ b/framework/core/src/Notification/NotificationSyncer.php @@ -11,7 +11,6 @@ namespace Flarum\Notification; use Flarum\Notification\Blueprint\BlueprintInterface; use Flarum\Notification\Driver\NotificationDriverInterface; -use Flarum\Notification\Event\Sending; use Flarum\User\User; /** @@ -110,11 +109,6 @@ class NotificationSyncer foreach (static::getNotificationDrivers() as $driverName => $driver) { $driver->send($blueprint, $newRecipients); } - - if (count($newRecipients)) { - // Deprecated in beta 15, removed in beta 16 - event(new Sending($blueprint, $newRecipients)); - } } /**