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:
@@ -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;
|
||||
}));
|
||||
}, []);
|
||||
|
||||
Reference in New Issue
Block a user