From ee72d6fcf93c71e9751ea8decf5be6ee615263c9 Mon Sep 17 00:00:00 2001 From: Patrick Niebeling Date: Thu, 13 Aug 2026 15:36:39 +0200 Subject: [PATCH] Do not move cards that are in the trash Deck's CardMapper::findAllByStack() filters on stack_id and archived only -- there is no deleted_at condition -- so getActiveCardsInStack() also returned cards the user had deleted. They stay in the table until Deck's DeleteCron purges them, which is long enough for an overdue one to get moved out of the trash and back into a stack. --- lib/Service/DeckIntegrationService.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/Service/DeckIntegrationService.php b/lib/Service/DeckIntegrationService.php index d2e5007..78a07d0 100644 --- a/lib/Service/DeckIntegrationService.php +++ b/lib/Service/DeckIntegrationService.php @@ -191,8 +191,14 @@ class DeckIntegrationService { } /** - * Cards in the given stack that are neither archived nor marked done, - * enriched so getAssignedUsers()/getLabels() are populated. + * Cards in the given stack that are neither archived, deleted nor marked + * done, enriched so getAssignedUsers()/getLabels() are populated. + * + * The `deletedAt` check is not redundant: Deck's + * `CardMapper::findAllByStack()` filters on `stack_id` and + * `archived = false` only, so cards sitting in the trash come back too — + * they are kept until Deck's own DeleteCron purges them. Without this we + * would move cards the user already deleted. * * @return Card[] */ @@ -205,6 +211,9 @@ class DeckIntegrationService { $cards = $cardService->enrichCards($cards); return array_values(array_filter($cards, static function (Card $card) { + if (method_exists($card, 'getDeletedAt') && (int)$card->getDeletedAt() > 0) { + return false; + } return !$card->getArchived() && $card->getDone() === null; })); }, []);