Compare commits
1 Commits
mod-1
...
enh/intera
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c9fc601fc |
@@ -31,6 +31,7 @@ use OCP\L10N\IFactory;
|
|||||||
use OCP\Notification\AlreadyProcessedException;
|
use OCP\Notification\AlreadyProcessedException;
|
||||||
use OCP\Notification\INotification;
|
use OCP\Notification\INotification;
|
||||||
use OCP\Notification\INotifier;
|
use OCP\Notification\INotifier;
|
||||||
|
use OCP\Notification\IAction;
|
||||||
|
|
||||||
class Notifier implements INotifier {
|
class Notifier implements INotifier {
|
||||||
/** @var IFactory */
|
/** @var IFactory */
|
||||||
@@ -120,6 +121,7 @@ class Notifier implements INotifier {
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
$notification->setLink($this->url->linkToRouteAbsolute('deck.page.index') . '#/board/' . $boardId . '/card/' . $cardId . '');
|
$notification->setLink($this->url->linkToRouteAbsolute('deck.page.index') . '#/board/' . $boardId . '/card/' . $cardId . '');
|
||||||
|
$notification = $this->addActionButton($notification, $l->t('View card'));
|
||||||
break;
|
break;
|
||||||
case 'card-overdue':
|
case 'card-overdue':
|
||||||
$cardId = $notification->getObjectId();
|
$cardId = $notification->getObjectId();
|
||||||
@@ -131,6 +133,9 @@ class Notifier implements INotifier {
|
|||||||
(string) $l->t('The card "%s" on "%s" has reached its due date.', $params)
|
(string) $l->t('The card "%s" on "%s" has reached its due date.', $params)
|
||||||
);
|
);
|
||||||
$notification->setLink($this->url->linkToRouteAbsolute('deck.page.index') . '#/board/' . $boardId . '/card/' . $cardId . '');
|
$notification->setLink($this->url->linkToRouteAbsolute('deck.page.index') . '#/board/' . $boardId . '/card/' . $cardId . '');
|
||||||
|
$notification = $this->addActionButton($notification, $l->t('View card'));
|
||||||
|
// $notification = $this->addActionButton($notification, $l->t('Set due to tomorrow'), false);
|
||||||
|
$notification = $this->addActionButtonChangeDueDate($notification, $l->t('Remove due date'), false);
|
||||||
break;
|
break;
|
||||||
case 'card-comment-mentioned':
|
case 'card-comment-mentioned':
|
||||||
$cardId = $notification->getObjectId();
|
$cardId = $notification->getObjectId();
|
||||||
@@ -161,6 +166,7 @@ class Notifier implements INotifier {
|
|||||||
$notification->setParsedMessage($notification->getMessageParameters()['message']);
|
$notification->setParsedMessage($notification->getMessageParameters()['message']);
|
||||||
}
|
}
|
||||||
$notification->setLink($this->url->linkToRouteAbsolute('deck.page.index') . '#/board/' . $boardId . '/card/' . $cardId . '');
|
$notification->setLink($this->url->linkToRouteAbsolute('deck.page.index') . '#/board/' . $boardId . '/card/' . $cardId . '');
|
||||||
|
$notification = $this->addActionButton($notification, $l->t('View card'));
|
||||||
break;
|
break;
|
||||||
case 'board-shared':
|
case 'board-shared':
|
||||||
$boardId = $notification->getObjectId();
|
$boardId = $notification->getObjectId();
|
||||||
@@ -187,8 +193,34 @@ class Notifier implements INotifier {
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
$notification->setLink($this->url->linkToRouteAbsolute('deck.page.index') . '#/board/' . $boardId . '/');
|
$notification->setLink($this->url->linkToRouteAbsolute('deck.page.index') . '#/board/' . $boardId . '/');
|
||||||
|
$notification = $this->addActionButton($notification, $l->t('View board'));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return $notification;
|
return $notification;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function addActionButton(INotification $notification, string $label, bool $primary = true): INotification {
|
||||||
|
$action = $notification->createAction();
|
||||||
|
$action->setLabel($label)
|
||||||
|
->setParsedLabel($label)
|
||||||
|
->setLink($notification->getLink(), IAction::TYPE_WEB)
|
||||||
|
->setPrimary($primary);
|
||||||
|
|
||||||
|
$notification->addParsedAction($action);
|
||||||
|
|
||||||
|
return $notification;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function addActionButtonChangeDueDate(INotification $notification, string $label, bool $primary = true): INotification {
|
||||||
|
$action = $notification->createAction();
|
||||||
|
$action->setLabel($label)
|
||||||
|
->setParsedLabel($label)
|
||||||
|
->setLink($notification->getLink(), IAction::TYPE_WEB)
|
||||||
|
->setPrimary($primary);
|
||||||
|
|
||||||
|
$notification->addParsedAction($action);
|
||||||
|
|
||||||
|
return $notification;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user