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.
This commit is contained in:
Patrick Niebeling
2026-08-13 15:36:39 +02:00
parent 80371d48fb
commit ee72d6fcf9
+11 -2
View File
@@ -191,8 +191,14 @@ class DeckIntegrationService {
} }
/** /**
* Cards in the given stack that are neither archived nor marked done, * Cards in the given stack that are neither archived, deleted nor marked
* enriched so getAssignedUsers()/getLabels() are populated. * 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[] * @return Card[]
*/ */
@@ -205,6 +211,9 @@ class DeckIntegrationService {
$cards = $cardService->enrichCards($cards); $cards = $cardService->enrichCards($cards);
return array_values(array_filter($cards, static function (Card $card) { 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; return !$card->getArchived() && $card->getDone() === null;
})); }));
}, []); }, []);