Remove favorite on card removed (#9364)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina
2025-06-25 12:18:05 +04:00
committed by GitHub
parent 702b51b51b
commit 1ea0e0fa3f
@@ -282,6 +282,10 @@ async function OnCardRemove (ctx: TxRemoveDoc<Card>[], control: TriggerControl):
})
)
}
const favorites = await control.findAll(control.ctx, card.class.FavoriteCard, { attachedTo: removedCard._id })
for (const favorite of favorites) {
res.push(control.txFactory.createTxRemoveDoc(favorite._class, favorite.space, favorite._id))
}
const event: RemoveCardEvent = {
type: CardEventType.RemoveCard,