From 1ea0e0fa3f7cf2a606c71061a0694d6fcecb5f50 Mon Sep 17 00:00:00 2001 From: Kristina Date: Wed, 25 Jun 2025 12:18:05 +0400 Subject: [PATCH] Remove favorite on card removed (#9364) Signed-off-by: Kristina Fefelova --- server-plugins/card-resources/src/index.ts | 4 ++++ 1 file changed, 4 insertions(+) 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,