Add notification on card assignment to user
Signed-off-by: Steav <steav8@gmail.com>
This commit is contained in:
@@ -94,6 +94,24 @@ class NotificationHelper {
|
||||
$this->cardMapper->markNotified($card);
|
||||
}
|
||||
|
||||
public function sendCardAssigned($card, $userId) {
|
||||
$boardId = $this->cardMapper->findBoardId($card->getId());
|
||||
$board = $this->getBoard($boardId);
|
||||
|
||||
$notification = $this->notificationManager->createNotification();
|
||||
$notification
|
||||
->setApp('deck')
|
||||
->setUser((string) $userId)
|
||||
->setDateTime(new DateTime())
|
||||
->setObject('card', $card->getId())
|
||||
->setSubject('card-assigned', [
|
||||
$card->getTitle(),
|
||||
$board->getTitle(),
|
||||
$this->currentUser
|
||||
]);
|
||||
$this->notificationManager->notify($notification);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send notifications that a board was shared with a user/group
|
||||
*
|
||||
|
||||
@@ -73,6 +73,18 @@ class Notifier implements INotifier {
|
||||
$params = $notification->getSubjectParameters();
|
||||
|
||||
switch ($notification->getSubject()) {
|
||||
case 'card-assigned':
|
||||
$cardId = $notification->getObjectId();
|
||||
$boardId = $this->cardMapper->findBoardId($cardId);
|
||||
$initiator = $this->userManager->get($params[2]);
|
||||
if ($initiator !== null) {
|
||||
$params[2] = $initiator->getDisplayName();
|
||||
}
|
||||
$notification->setParsedSubject(
|
||||
(string) $l->t('The card "%s" on "%s" has been assigned to you by %s.', $params)
|
||||
);
|
||||
$notification->setLink($this->url->linkToRouteAbsolute('deck.page.index') . '#!/board/' . $boardId . '//card/' . $cardId . '');
|
||||
break;
|
||||
case 'card-overdue':
|
||||
$cardId = $notification->getObjectId();
|
||||
$boardId = $this->cardMapper->findBoardId($cardId);
|
||||
|
||||
Reference in New Issue
Block a user