Show changes in task update notifications
This commit is contained in:
@@ -268,7 +268,7 @@ class Notification extends Base
|
|||||||
{
|
{
|
||||||
return $this->template->render(
|
return $this->template->render(
|
||||||
'notification/'.str_replace('.', '_', $event_name),
|
'notification/'.str_replace('.', '_', $event_name),
|
||||||
$event_data + array('application_url' => $this->config->get('application_url'))
|
$event_data + array('application_url' => $this->config->get('application_url'), 'colors_list' => $this->color->getList())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ class NotificationSubscriber extends \Core\Base implements EventSubscriberInterf
|
|||||||
switch (get_class($event)) {
|
switch (get_class($event)) {
|
||||||
case 'Event\TaskEvent':
|
case 'Event\TaskEvent':
|
||||||
$values['task'] = $this->taskFinder->getDetails($event['task_id']);
|
$values['task'] = $this->taskFinder->getDetails($event['task_id']);
|
||||||
|
$values['changes'] = isset($event['changes']) ? $event['changes'] : array();
|
||||||
break;
|
break;
|
||||||
case 'Event\SubtaskEvent':
|
case 'Event\SubtaskEvent':
|
||||||
$values['subtask'] = $this->subtask->getById($event['id'], true);
|
$values['subtask'] = $this->subtask->getById($event['id'], true);
|
||||||
|
|||||||
@@ -1,43 +1,65 @@
|
|||||||
<h2><?= $this->e($task['title']) ?> (#<?= $task['id'] ?>)</h2>
|
<h2><?= $this->e($task['title']) ?> (#<?= $task['id'] ?>)</h2>
|
||||||
|
|
||||||
|
<?= t('The task have been updated.') ?>
|
||||||
|
|
||||||
|
<?php if (! empty($changes)): ?>
|
||||||
|
<h2><?= t('List of changes') ?></h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<?php
|
||||||
<?= dt('Created on %B %e, %Y at %k:%M %p', $task['date_creation']) ?>
|
|
||||||
</li>
|
foreach ($changes as $field => $value) {
|
||||||
<?php if ($task['date_due']): ?>
|
|
||||||
<li>
|
switch ($field) {
|
||||||
<strong><?= dt('Must be done before %B %e, %Y', $task['date_due']) ?></strong>
|
case 'title':
|
||||||
</li>
|
echo '<li>'.t('New title: %s', $task['title']).'</li>';
|
||||||
<?php endif ?>
|
break;
|
||||||
<?php if ($task['creator_username']): ?>
|
case 'owner_id':
|
||||||
<li>
|
if (empty($task['owner_id'])) {
|
||||||
<?= t('Created by %s', $task['creator_name'] ?: $task['creator_username']) ?>
|
echo '<li>'.t('The task is not assigned anymore').'</li>';
|
||||||
</li>
|
}
|
||||||
<?php endif ?>
|
else {
|
||||||
<li>
|
echo '<li>'.t('New assignee: %s', $task['assignee_name'] ?: $task['assignee_username']).'</li>';
|
||||||
<strong>
|
}
|
||||||
<?php if ($task['assignee_username']): ?>
|
break;
|
||||||
<?= t('Assigned to %s', $task['assignee_name'] ?: $task['assignee_username']) ?>
|
case 'category_id':
|
||||||
<?php else: ?>
|
if (empty($task['category_id'])) {
|
||||||
<?= t('There is nobody assigned') ?>
|
echo '<li>'.t('There is no category now').'</li>';
|
||||||
<?php endif ?>
|
}
|
||||||
</strong>
|
else {
|
||||||
</li>
|
echo '<li>'.t('New category: %s', $task['category_name']).'</li>';
|
||||||
<li>
|
}
|
||||||
<?= t('Column on the board:') ?>
|
break;
|
||||||
<strong><?= $this->e($task['column_title']) ?></strong>
|
case 'color_id':
|
||||||
</li>
|
echo '<li>'.t('New color: %s', $this->text->in($task['color_id'], $colors_list)).'</li>';
|
||||||
<li><?= t('Task position:').' '.$this->e($task['position']) ?></li>
|
break;
|
||||||
<?php if ($task['category_name']): ?>
|
case 'score':
|
||||||
<li>
|
echo '<li>'.t('New complexity: %d', $task['score']).'</li>';
|
||||||
<?= t('Category:') ?> <strong><?= $this->e($task['category_name']) ?></strong>
|
break;
|
||||||
</li>
|
case 'date_due':
|
||||||
<?php endif ?>
|
if (empty($task['date_due'])) {
|
||||||
|
echo '<li>'.t('The due date have been removed').'</li>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo '<li>'.dt('New due date: %B %e, %Y', $task['date_due']).'</li>';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'description':
|
||||||
|
if (empty($task['description'])) {
|
||||||
|
echo '<li>'.t('There is no description anymore').'</li>';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
echo '<li>'.t('The field "%s" have been updated', $field).'</li>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<?php if (! empty($task['description'])): ?>
|
<?php if (! empty($changes['description'])): ?>
|
||||||
<h2><?= t('Description') ?></h2>
|
<h3><?= t('New description') ?></h3>
|
||||||
<?= $this->text->markdown($task['description']) ?: t('There is no description.') ?>
|
<?= $this->text->markdown($task['description']) ?>
|
||||||
|
<?php endif ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?= $this->render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
|
<?= $this->render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
|
||||||
Reference in New Issue
Block a user