summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/Model/Notification.php36
1 files changed, 24 insertions, 12 deletions
diff --git a/app/Model/Notification.php b/app/Model/Notification.php
index 95306e86..49691f85 100644
--- a/app/Model/Notification.php
+++ b/app/Model/Notification.php
@@ -119,6 +119,18 @@ class Notification extends Base
}
/**
+ * Get the mail subject for a given label
+ *
+ * @access private
+ * @param string $label Label
+ * @param array $data Template data
+ */
+ private function getStandardMailSubject($label, array $data)
+ {
+ return e('[%s][%s] %s (#%d)', $data['task']['project_name'], $label, $data['task']['title'], $data['task']['id']);
+ }
+
+ /**
* Get the mail subject for a given template name
*
* @access public
@@ -129,40 +141,40 @@ class Notification extends Base
{
switch ($template) {
case 'file_creation':
- $subject = e('[%s][New attachment] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
+ $subject = $this->getStandardMailSubject('New attachment', $data);
break;
case 'comment_creation':
- $subject = e('[%s][New comment] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
+ $subject = $this->getStandardMailSubject('New comment', $data);
break;
case 'comment_update':
- $subject = e('[%s][Comment updated] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
+ $subject = $this->getStandardMailSubject('Comment updated', $data);
break;
case 'subtask_creation':
- $subject = e('[%s][New subtask] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
+ $subject = $this->getStandardMailSubject('New subtask', $data);
break;
case 'subtask_update':
- $subject = e('[%s][Subtask updated] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
+ $subject = $this->getStandardMailSubject('Subtask updated', $data);
break;
case 'task_creation':
- $subject = e('[%s][New task] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
+ $subject = $this->getStandardMailSubject('New task', $data);
break;
case 'task_update':
- $subject = e('[%s][Task updated] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
+ $subject = $this->getStandardMailSubject('Task updated', $data);
break;
case 'task_close':
- $subject = e('[%s][Task closed] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
+ $subject = $this->getStandardMailSubject('Task closed', $data);
break;
case 'task_open':
- $subject = e('[%s][Task opened] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
+ $subject = $this->getStandardMailSubject('Task opened', $data);
break;
case 'task_move_column':
- $subject = e('[%s][Column Change] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
+ $subject = $this->getStandardMailSubject('Column Change', $data);
break;
case 'task_move_position':
- $subject = e('[%s][Position Change] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
+ $subject = $this->getStandardMailSubject('Position Change', $data);
break;
case 'task_assignee_change':
- $subject = e('[%s][Assignee Change] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
+ $subject = $this->getStandardMailSubject('Assignee Change', $data);
break;
case 'task_due':
$subject = e('[%s][Due tasks]', $data['project']);