diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-02-07 14:13:01 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-02-07 14:13:01 -0500 |
commit | a0f4343ef58ba09d8b74fd44d4e2bc9011c382ea (patch) | |
tree | a1c385c91937f5ce61502fccd851ec85305c2ff4 /app/Model | |
parent | 1a109f11a3059c35f16d5f9f1d6365ac652d71c9 (diff) | |
parent | ce13fced30fffa78c1a0e73368f39b6381643c1f (diff) |
Merge pull-request #592
Diffstat (limited to 'app/Model')
-rw-r--r-- | app/Model/Notification.php | 36 | ||||
-rw-r--r-- | app/Model/ProjectDuplication.php | 4 |
2 files changed, 26 insertions, 14 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']); diff --git a/app/Model/ProjectDuplication.php b/app/Model/ProjectDuplication.php index 11a606d7..ef4558ba 100644 --- a/app/Model/ProjectDuplication.php +++ b/app/Model/ProjectDuplication.php @@ -23,8 +23,8 @@ class ProjectDuplication extends Base { $suffix = ' ('.t('Clone').')'; - if (strlen($name.$suffix) > 50) { - $name = substr($name, 0, 50 - strlen($suffix)); + if (strlen($name.$suffix) > $max_length) { + $name = substr($name, 0, $max_length - strlen($suffix)); } return $name.$suffix; |