diff options
Diffstat (limited to 'app/Notification')
-rw-r--r-- | app/Notification/ActivityStreamNotification.php (renamed from app/Notification/ActivityStream.php) | 7 | ||||
-rw-r--r-- | app/Notification/MailNotification.php (renamed from app/Notification/Mail.php) | 47 | ||||
-rw-r--r-- | app/Notification/NotificationInterface.php | 32 | ||||
-rw-r--r-- | app/Notification/WebNotification.php (renamed from app/Notification/Web.php) | 7 | ||||
-rw-r--r-- | app/Notification/WebhookNotification.php (renamed from app/Notification/Webhook.php) | 9 |
5 files changed, 37 insertions, 65 deletions
diff --git a/app/Notification/ActivityStream.php b/app/Notification/ActivityStreamNotification.php index 325732ec..9f23c88a 100644 --- a/app/Notification/ActivityStream.php +++ b/app/Notification/ActivityStreamNotification.php @@ -3,14 +3,15 @@ namespace Kanboard\Notification; use Kanboard\Core\Base; +use Kanboard\Core\Notification\NotificationInterface; /** * Activity Stream Notification * - * @package notification + * @package Kanboard\Notification * @author Frederic Guillot */ -class ActivityStream extends Base implements NotificationInterface +class ActivityStreamNotification extends Base implements NotificationInterface { /** * Send notification to a user @@ -35,7 +36,7 @@ class ActivityStream extends Base implements NotificationInterface public function notifyProject(array $project, $event_name, array $event_data) { if ($this->userSession->isLogged()) { - $this->projectActivity->createEvent( + $this->projectActivityModel->createEvent( $project['id'], $event_data['task']['id'], $this->userSession->getId(), diff --git a/app/Notification/Mail.php b/app/Notification/MailNotification.php index c924fb50..2d27179c 100644 --- a/app/Notification/Mail.php +++ b/app/Notification/MailNotification.php @@ -3,18 +3,19 @@ namespace Kanboard\Notification; use Kanboard\Core\Base; -use Kanboard\Model\Task; -use Kanboard\Model\TaskFile; -use Kanboard\Model\Comment; -use Kanboard\Model\Subtask; +use Kanboard\Core\Notification\NotificationInterface; +use Kanboard\Model\TaskModel; +use Kanboard\Model\TaskFileModel; +use Kanboard\Model\CommentModel; +use Kanboard\Model\SubtaskModel; /** * Email Notification * - * @package notification + * @package Kanboard\Notification * @author Frederic Guillot */ -class Mail extends Base implements NotificationInterface +class MailNotification extends Base implements NotificationInterface { /** * Notification type @@ -67,7 +68,7 @@ class Mail extends Base implements NotificationInterface { return $this->template->render( 'notification/'.str_replace('.', '_', $event_name), - $event_data + array('application_url' => $this->config->get('application_url')) + $event_data + array('application_url' => $this->configModel->get('application_url')) ); } @@ -82,50 +83,50 @@ class Mail extends Base implements NotificationInterface public function getMailSubject($event_name, array $event_data) { switch ($event_name) { - case TaskFile::EVENT_CREATE: + case TaskFileModel::EVENT_CREATE: $subject = $this->getStandardMailSubject(e('New attachment'), $event_data); break; - case Comment::EVENT_CREATE: + case CommentModel::EVENT_CREATE: $subject = $this->getStandardMailSubject(e('New comment'), $event_data); break; - case Comment::EVENT_UPDATE: + case CommentModel::EVENT_UPDATE: $subject = $this->getStandardMailSubject(e('Comment updated'), $event_data); break; - case Subtask::EVENT_CREATE: + case SubtaskModel::EVENT_CREATE: $subject = $this->getStandardMailSubject(e('New subtask'), $event_data); break; - case Subtask::EVENT_UPDATE: + case SubtaskModel::EVENT_UPDATE: $subject = $this->getStandardMailSubject(e('Subtask updated'), $event_data); break; - case Task::EVENT_CREATE: + case TaskModel::EVENT_CREATE: $subject = $this->getStandardMailSubject(e('New task'), $event_data); break; - case Task::EVENT_UPDATE: + case TaskModel::EVENT_UPDATE: $subject = $this->getStandardMailSubject(e('Task updated'), $event_data); break; - case Task::EVENT_CLOSE: + case TaskModel::EVENT_CLOSE: $subject = $this->getStandardMailSubject(e('Task closed'), $event_data); break; - case Task::EVENT_OPEN: + case TaskModel::EVENT_OPEN: $subject = $this->getStandardMailSubject(e('Task opened'), $event_data); break; - case Task::EVENT_MOVE_COLUMN: + case TaskModel::EVENT_MOVE_COLUMN: $subject = $this->getStandardMailSubject(e('Column change'), $event_data); break; - case Task::EVENT_MOVE_POSITION: + case TaskModel::EVENT_MOVE_POSITION: $subject = $this->getStandardMailSubject(e('Position change'), $event_data); break; - case Task::EVENT_MOVE_SWIMLANE: + case TaskModel::EVENT_MOVE_SWIMLANE: $subject = $this->getStandardMailSubject(e('Swimlane change'), $event_data); break; - case Task::EVENT_ASSIGNEE_CHANGE: + case TaskModel::EVENT_ASSIGNEE_CHANGE: $subject = $this->getStandardMailSubject(e('Assignee change'), $event_data); break; - case Task::EVENT_USER_MENTION: - case Comment::EVENT_USER_MENTION: + case TaskModel::EVENT_USER_MENTION: + case CommentModel::EVENT_USER_MENTION: $subject = $this->getStandardMailSubject(e('Mentioned'), $event_data); break; - case Task::EVENT_OVERDUE: + case TaskModel::EVENT_OVERDUE: $subject = e('[%s] Overdue tasks', $event_data['project_name']); break; default: diff --git a/app/Notification/NotificationInterface.php b/app/Notification/NotificationInterface.php deleted file mode 100644 index 8431a77c..00000000 --- a/app/Notification/NotificationInterface.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php - -namespace Kanboard\Notification; - -/** - * Notification Interface - * - * @package core - * @author Frederic Guillot - */ -interface NotificationInterface -{ - /** - * Send notification to a user - * - * @access public - * @param array $user - * @param string $event_name - * @param array $event_data - */ - public function notifyUser(array $user, $event_name, array $event_data); - - /** - * Send notification to a project - * - * @access public - * @param array $project - * @param string $event_name - * @param array $event_data - */ - public function notifyProject(array $project, $event_name, array $event_data); -} diff --git a/app/Notification/Web.php b/app/Notification/WebNotification.php index 9271c193..d8818828 100644 --- a/app/Notification/Web.php +++ b/app/Notification/WebNotification.php @@ -3,14 +3,15 @@ namespace Kanboard\Notification; use Kanboard\Core\Base; +use Kanboard\Core\Notification\NotificationInterface; /** * Web Notification * - * @package notification + * @package Kanboard\Notification * @author Frederic Guillot */ -class Web extends Base implements NotificationInterface +class WebNotification extends Base implements NotificationInterface { /** * Notification type @@ -29,7 +30,7 @@ class Web extends Base implements NotificationInterface */ public function notifyUser(array $user, $event_name, array $event_data) { - $this->userUnreadNotification->create($user['id'], $event_name, $event_data); + $this->userUnreadNotificationModel->create($user['id'], $event_name, $event_data); } /** diff --git a/app/Notification/Webhook.php b/app/Notification/WebhookNotification.php index e187909f..16045535 100644 --- a/app/Notification/Webhook.php +++ b/app/Notification/WebhookNotification.php @@ -3,14 +3,15 @@ namespace Kanboard\Notification; use Kanboard\Core\Base; +use Kanboard\Core\Notification\NotificationInterface; /** * Webhook Notification * - * @package notification + * @package Kanboard\Notification * @author Frederic Guillot */ -class Webhook extends Base implements NotificationInterface +class WebhookNotification extends Base implements NotificationInterface { /** * Send notification to a user @@ -34,8 +35,8 @@ class Webhook extends Base implements NotificationInterface */ public function notifyProject(array $project, $event_name, array $event_data) { - $url = $this->config->get('webhook_url'); - $token = $this->config->get('webhook_token'); + $url = $this->configModel->get('webhook_url'); + $token = $this->configModel->get('webhook_token'); if (! empty($url)) { if (strpos($url, '?') !== false) { |