diff --git a/server-plugins/card-resources/src/index.ts b/server-plugins/card-resources/src/index.ts index 93d4489a60..a869f9c2c2 100644 --- a/server-plugins/card-resources/src/index.ts +++ b/server-plugins/card-resources/src/index.ts @@ -282,6 +282,10 @@ async function OnCardRemove (ctx: TxRemoveDoc[], 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,