diff options
Diffstat (limited to 'app/Subscriber')
-rw-r--r-- | app/Subscriber/ProjectActivitySubscriber.php | 27 | ||||
-rw-r--r-- | app/Subscriber/TransitionSubscriber.php | 26 |
2 files changed, 53 insertions, 0 deletions
diff --git a/app/Subscriber/ProjectActivitySubscriber.php b/app/Subscriber/ProjectActivitySubscriber.php index 00f5b044..42314637 100644 --- a/app/Subscriber/ProjectActivitySubscriber.php +++ b/app/Subscriber/ProjectActivitySubscriber.php @@ -41,6 +41,33 @@ class ProjectActivitySubscriber extends Base implements EventSubscriberInterface $event_name, $values ); + + $this->sendSlackNotification($event_name, $values); + $this->sendHipchatNotification($event_name, $values); + } + } + + private function sendSlackNotification($event_name, array $values) + { + if ($this->config->get('integration_slack_webhook') == 1) { + $this->slackWebhook->notify( + $values['task']['project_id'], + $values['task']['id'], + $event_name, + $values + ); + } + } + + private function sendHipchatNotification($event_name, array $values) + { + if ($this->config->get('integration_hipchat') == 1) { + $this->hipchat->notify( + $values['task']['project_id'], + $values['task']['id'], + $event_name, + $values + ); } } diff --git a/app/Subscriber/TransitionSubscriber.php b/app/Subscriber/TransitionSubscriber.php new file mode 100644 index 00000000..347dd37d --- /dev/null +++ b/app/Subscriber/TransitionSubscriber.php @@ -0,0 +1,26 @@ +<?php + +namespace Subscriber; + +use Event\TaskEvent; +use Model\Task; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; + +class TransitionSubscriber extends Base implements EventSubscriberInterface +{ + public static function getSubscribedEvents() + { + return array( + Task::EVENT_MOVE_COLUMN => array('execute', 0), + ); + } + + public function execute(TaskEvent $event) + { + $user_id = $this->userSession->getId(); + + if (! empty($user_id)) { + $this->transition->save($user_id, $event->getAll()); + } + } +}
\ No newline at end of file |