From 472f94efee77d8f47ece4ead7d36ee02e5df3e56 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 17 Oct 2015 12:30:05 -0400 Subject: Move webhook to project notification type --- app/Subscriber/NotificationSubscriber.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'app/Subscriber/NotificationSubscriber.php') diff --git a/app/Subscriber/NotificationSubscriber.php b/app/Subscriber/NotificationSubscriber.php index 07ce00a1..394573e4 100644 --- a/app/Subscriber/NotificationSubscriber.php +++ b/app/Subscriber/NotificationSubscriber.php @@ -32,17 +32,25 @@ class NotificationSubscriber extends \Kanboard\Core\Base implements EventSubscri public function execute(GenericEvent $event, $event_name) { - $this->userNotification->sendNotifications($event_name, $this->getEventData($event)); + $event_data = $this->getEventData($event); + + if (! empty($event_data)) { + $this->userNotification->sendNotifications($event_name, $event_data); + $this->projectNotification->sendNotifications($event_data['task']['project_id'], $event_name, $event_data); + } } public function getEventData(GenericEvent $event) { $values = array(); + if (! empty($event['changes'])) { + $values['changes'] = $event['changes']; + } + switch (get_class($event)) { case 'Kanboard\Event\TaskEvent': $values['task'] = $this->taskFinder->getDetails($event['task_id']); - $values['changes'] = isset($event['changes']) ? $event['changes'] : array(); break; case 'Kanboard\Event\SubtaskEvent': $values['subtask'] = $this->subtask->getById($event['id'], true); -- cgit v1.2.3