From 8b750b7c7cfc12e7c3102084718b78348e6c94e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Thu, 20 Dec 2018 10:45:56 +0100 Subject: [PATCH] Mark notification as read if a card with duedate gets archived MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/Notification/NotificationHelper.php | 9 +++++++++ lib/Service/CardService.php | 1 + 2 files changed, 10 insertions(+) diff --git a/lib/Notification/NotificationHelper.php b/lib/Notification/NotificationHelper.php index 5de17fe1f..b47c02832 100644 --- a/lib/Notification/NotificationHelper.php +++ b/lib/Notification/NotificationHelper.php @@ -95,6 +95,15 @@ class NotificationHelper { $this->cardMapper->markNotified($card); } + public function markDuedateAsRead($card) { + $notification = $this->notificationManager->createNotification(); + $notification + ->setApp('deck') + ->setObject('card', $card->getId()) + ->setSubject('card-overdue', []); + $this->notificationManager->markProcessed($notification); + } + public function sendCardAssigned($card, $userId) { $boardId = $this->cardMapper->findBoardId($card->getId()); $board = $this->getBoard($boardId); diff --git a/lib/Service/CardService.php b/lib/Service/CardService.php index 94d773524..09138028d 100644 --- a/lib/Service/CardService.php +++ b/lib/Service/CardService.php @@ -407,6 +407,7 @@ class CardService { $card = $this->cardMapper->find($id); $card->setArchived(true); $newCard = $this->cardMapper->update($card); + $this->notificationHelper->markDuedateAsRead($card); $this->activityManager->triggerEvent(ActivityManager::DECK_OBJECT_CARD, $newCard, ActivityManager::SUBJECT_CARD_UPDATE_ARCHIVE); $this->changeHelper->cardChanged($id, false); return $newCard;