mirror of
https://github.com/flarum/framework.git
synced 2024-11-22 12:48:28 +08:00
Remove deprecated notification events
This commit is contained in:
parent
46248f601d
commit
bbb7679417
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* For detailed copyright and license information, please view the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Event;
|
||||
|
||||
use Flarum\Notification\Blueprint\BlueprintInterface;
|
||||
use InvalidArgumentException;
|
||||
use ReflectionClass;
|
||||
|
||||
/**
|
||||
* @deprecated in beta 15, removed in beta 16
|
||||
*/
|
||||
class ConfigureNotificationTypes
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $blueprints;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $serializers;
|
||||
|
||||
/**
|
||||
* @param array $blueprints
|
||||
* @param array $serializers
|
||||
*/
|
||||
public function __construct(array &$blueprints, array &$serializers = [])
|
||||
{
|
||||
$this->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;
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* For detailed copyright and license information, please view the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Notification\Event;
|
||||
|
||||
use Flarum\Notification\Blueprint\BlueprintInterface;
|
||||
|
||||
/**
|
||||
* @deprecated in beta 15, removed in beta 16
|
||||
*/
|
||||
class Sending
|
||||
{
|
||||
/**
|
||||
* The blueprint for the notification.
|
||||
*
|
||||
* @var BlueprintInterface
|
||||
*/
|
||||
public $blueprint;
|
||||
|
||||
/**
|
||||
* The users that the notification will be sent to.
|
||||
*
|
||||
* @var array|int[]
|
||||
*/
|
||||
public $users;
|
||||
|
||||
/**
|
||||
* @param \Flarum\Notification\Blueprint\BlueprintInterface $blueprint
|
||||
* @param \Flarum\User\User[] $users
|
||||
*/
|
||||
public function __construct(BlueprintInterface $blueprint, array &$users)
|
||||
{
|
||||
$this->blueprint = $blueprint;
|
||||
$this->users = &$users;
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user