Try to fix missing communication broadcast events (#9384)

This commit is contained in:
Kristina
2025-06-29 18:24:20 +07:00
committed by GitHub
parent 47f7e107f2
commit 7cf2fe2041
9 changed files with 65 additions and 33 deletions
@@ -75,6 +75,7 @@ async function createMessages (tx: TxCUD<Card>, control: TriggerControl, card: C
result.push({ action })
}
const events: CreateMessageEvent[] = []
for (const data of result) {
const event: CreateMessageEvent = {
type: MessageEventType.CreateMessage,
@@ -86,9 +87,12 @@ async function createMessages (tx: TxCUD<Card>, control: TriggerControl, card: C
extra: data,
date: new Date(tx.modifiedOn)
}
void control.domainRequest(control.ctx, 'communication' as OperationDomain, { event })
events.push(event)
}
await Promise.all(
events.map((event) => control.domainRequest(control.ctx, 'communication' as OperationDomain, { event }))
)
}
function getActivityAction (control: ActivityControl, tx: TxCUD<Doc>): 'create' | 'remove' | 'update' {