diff options
Diffstat (limited to 'app/Model/UserUnreadNotification.php')
-rw-r--r-- | app/Model/UserUnreadNotification.php | 63 |
1 files changed, 1 insertions, 62 deletions
diff --git a/app/Model/UserUnreadNotification.php b/app/Model/UserUnreadNotification.php index 98a337a2..cc0f326a 100644 --- a/app/Model/UserUnreadNotification.php +++ b/app/Model/UserUnreadNotification.php @@ -48,7 +48,7 @@ class UserUnreadNotification extends Base foreach ($events as &$event) { $event['event_data'] = json_decode($event['event_data'], true); - $event['title'] = $this->getTitleFromEvent($event['event_name'], $event['event_data']); + $event['title'] = $this->notification->getTitleWithoutAuthor($event['event_name'], $event['event_data']); } return $events; @@ -90,65 +90,4 @@ class UserUnreadNotification extends Base { return $this->db->table(self::TABLE)->eq('user_id', $user_id)->exists(); } - - /** - * Get title from event - * - * @access public - * @param string $event_name - * @param array $event_data - * @return string - */ - public function getTitleFromEvent($event_name, array $event_data) - { - switch ($event_name) { - case File::EVENT_CREATE: - $title = t('New attachment on task #%d: %s', $event_data['file']['task_id'], $event_data['file']['name']); - break; - case Comment::EVENT_CREATE: - $title = t('New comment on task #%d', $event_data['comment']['task_id']); - break; - case Comment::EVENT_UPDATE: - $title = t('Comment updated on task #%d', $event_data['comment']['task_id']); - break; - case Subtask::EVENT_CREATE: - $title = t('New subtask on task #%d', $event_data['subtask']['task_id']); - break; - case Subtask::EVENT_UPDATE: - $title = t('Subtask updated on task #%d', $event_data['subtask']['task_id']); - break; - case Task::EVENT_CREATE: - $title = t('New task #%d: %s', $event_data['task']['id'], $event_data['task']['title']); - break; - case Task::EVENT_UPDATE: - $title = t('Task updated #%d', $event_data['task']['id']); - break; - case Task::EVENT_CLOSE: - $title = t('Task #%d closed', $event_data['task']['id']); - break; - case Task::EVENT_OPEN: - $title = t('Task #%d opened', $event_data['task']['id']); - break; - case Task::EVENT_MOVE_COLUMN: - $title = t('Column changed for task #%d', $event_data['task']['id']); - break; - case Task::EVENT_MOVE_POSITION: - $title = t('New position for task #%d', $event_data['task']['id']); - break; - case Task::EVENT_MOVE_SWIMLANE: - $title = t('Swimlane changed for task #%d', $event_data['task']['id']); - break; - case Task::EVENT_ASSIGNEE_CHANGE: - $title = t('Assignee changed on task #%d', $event_data['task']['id']); - break; - case Task::EVENT_OVERDUE: - $nb = count($event_data['tasks']); - $title = $nb > 1 ? t('%d overdue tasks', $nb) : t('Task #%d is overdue', $event_data['tasks'][0]['id']); - break; - default: - $title = e('Notification'); - } - - return $title; - } } |