Cleanup types from spaces when removed (#10268)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov
2025-12-02 01:20:36 +05:00
committed by GitHub
parent 883d347525
commit 3ebd0ef1f4
2 changed files with 11 additions and 1 deletions
@@ -64,5 +64,5 @@
</script>
{#each todos as todo (todo._id)}
<Button label={getEmbeddedLabel(todo.title)} on:click={() => checkTodo(todo)} />
<Button kind={'primary'} label={getEmbeddedLabel(todo.title)} on:click={() => checkTodo(todo)} />
{/each}
@@ -155,6 +155,16 @@ async function OnMasterTagRemove (ctx: TxUpdateDoc<MasterTag>[], control: Trigge
for (const des of desc) {
res.push(...(await removeTagRelations(control, des)))
}
const spaces = await control.findAll(control.ctx, card.class.CardSpace, {
types: updateTx.objectId
})
for (const space of spaces) {
res.push(
control.txFactory.createTxUpdateDoc(space._class, space.space, space._id, {
types: space.types.filter((t) => t !== updateTx.objectId)
})
)
}
for (const des of desc) {
if (des === updateTx.objectId) continue
const _class = control.hierarchy.findClass(des)