Fixed empty title for web notification with only one overdue task
This commit is contained in:
@@ -149,7 +149,7 @@ class TaskOverdueNotificationCommand extends BaseCommand
|
||||
$this->userNotificationModel->sendUserNotification(
|
||||
$user,
|
||||
TaskModel::EVENT_OVERDUE,
|
||||
array('tasks' => $user_tasks, 'project_name' => implode(", ", $project_names))
|
||||
array('tasks' => $user_tasks, 'project_name' => implode(', ', $project_names))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,14 +54,14 @@ class WebNotificationController extends BaseController
|
||||
$this->response->redirect($this->helper->url->to(
|
||||
'TaskViewController',
|
||||
'show',
|
||||
array('task_id' => $notification['event_data']['task']['id'], 'project_id' => $notification['event_data']['task']['project_id']),
|
||||
array('task_id' => $this->notificationModel->getTaskIdFromEvent($notification['event_name'], $notification['event_data'])),
|
||||
'comment-'.$notification['event_data']['comment']['id']
|
||||
));
|
||||
} else {
|
||||
$this->response->redirect($this->helper->url->to(
|
||||
'TaskViewController',
|
||||
'show',
|
||||
array('task_id' => $notification['event_data']['task']['id'], 'project_id' => $notification['event_data']['task']['project_id'])
|
||||
array('task_id' => $this->notificationModel->getTaskIdFromEvent($notification['event_name'], $notification['event_data']))
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,4 +133,41 @@ class NotificationModel extends Base
|
||||
return e('Notification');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get task id from event
|
||||
*
|
||||
* @access public
|
||||
* @param string $event_name
|
||||
* @param array $event_data
|
||||
* @return integer
|
||||
*/
|
||||
public function getTaskIdFromEvent($event_name, array $event_data)
|
||||
{
|
||||
switch ($event_name) {
|
||||
case TaskFileModel::EVENT_CREATE:
|
||||
return $event_data['file']['task_id'];
|
||||
case CommentModel::EVENT_CREATE:
|
||||
case CommentModel::EVENT_UPDATE:
|
||||
return $event_data['comment']['task_id'];
|
||||
case SubtaskModel::EVENT_CREATE:
|
||||
case SubtaskModel::EVENT_UPDATE:
|
||||
return $event_data['subtask']['task_id'];
|
||||
case TaskModel::EVENT_CREATE:
|
||||
case TaskModel::EVENT_UPDATE:
|
||||
case TaskModel::EVENT_CLOSE:
|
||||
case TaskModel::EVENT_OPEN:
|
||||
case TaskModel::EVENT_MOVE_COLUMN:
|
||||
case TaskModel::EVENT_MOVE_POSITION:
|
||||
case TaskModel::EVENT_MOVE_SWIMLANE:
|
||||
case TaskModel::EVENT_ASSIGNEE_CHANGE:
|
||||
case CommentModel::EVENT_USER_MENTION:
|
||||
case TaskModel::EVENT_USER_MENTION:
|
||||
return $event_data['task']['id'];
|
||||
case TaskModel::EVENT_OVERDUE:
|
||||
return $event_data['tasks'][0]['id'];
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,10 +36,8 @@
|
||||
<i class="fa fa-file-o fa-fw"></i>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if ($this->text->contains($notification['event_name'], 'task.overdue')): ?>
|
||||
<?php if (count($notification['event_data']['tasks']) > 1): ?>
|
||||
<?= $notification['title'] ?>
|
||||
<?php endif ?>
|
||||
<?php if ($this->text->contains($notification['event_name'], 'task.overdue') && count($notification['event_data']['tasks']) > 1): ?>
|
||||
<?= $notification['title'] ?>
|
||||
<?php else: ?>
|
||||
<?= $this->url->link($notification['title'], 'WebNotificationController', 'redirect', array('notification_id' => $notification['id'], 'user_id' => $user['id'])) ?>
|
||||
<?php endif ?>
|
||||
|
||||
Reference in New Issue
Block a user