diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-06-07 20:06:31 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-06-07 20:06:31 -0400 |
commit | 4f32352fe62e47ad5ea760eb00493bdc061b2407 (patch) | |
tree | 8d5f087907dd5cba196dbfc06e626b3146659e1f /app/Subscriber | |
parent | 9d9e3afba2054bfa23ba6f019b7c8885c2d8415e (diff) |
Add user filter/condition for notifications
Diffstat (limited to 'app/Subscriber')
-rw-r--r-- | app/Subscriber/NotificationSubscriber.php | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/app/Subscriber/NotificationSubscriber.php b/app/Subscriber/NotificationSubscriber.php index 92d46754..41fd6aef 100644 --- a/app/Subscriber/NotificationSubscriber.php +++ b/app/Subscriber/NotificationSubscriber.php @@ -11,21 +11,6 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; class NotificationSubscriber extends \Core\Base implements EventSubscriberInterface { - private $templates = array( - Task::EVENT_CREATE => 'task_creation', - Task::EVENT_UPDATE => 'task_update', - Task::EVENT_CLOSE => 'task_close', - Task::EVENT_OPEN => 'task_open', - Task::EVENT_MOVE_COLUMN => 'task_move_column', - Task::EVENT_MOVE_POSITION => 'task_move_position', - Task::EVENT_ASSIGNEE_CHANGE => 'task_assignee_change', - Subtask::EVENT_CREATE => 'subtask_creation', - Subtask::EVENT_UPDATE => 'subtask_update', - Comment::EVENT_CREATE => 'comment_creation', - Comment::EVENT_UPDATE => 'comment_update', - File::EVENT_CREATE => 'file_creation', - ); - public static function getSubscribedEvents() { return array( @@ -46,18 +31,10 @@ class NotificationSubscriber extends \Core\Base implements EventSubscriberInterf public function execute(GenericEvent $event, $event_name) { - $values = $this->getTemplateData($event); - - if (isset($values['task']['project_id'])) { - $users = $this->notification->getUsersList($values['task']['project_id']); - - if (! empty($users)) { - $this->notification->sendEmails($this->templates[$event_name], $users, $values); - } - } + $this->notification->sendNotifications($event_name, $this->getEventData($event)); } - public function getTemplateData(GenericEvent $event) + public function getEventData(GenericEvent $event) { $values = array(); |