mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-22 01:25:00 +02:00
Try to fix missing communication broadcast events (#9384)
This commit is contained in:
@@ -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' {
|
||||
|
||||
@@ -294,7 +294,7 @@ async function OnCardRemove (ctx: TxRemoveDoc<Card>[], control: TriggerControl):
|
||||
socialId: removedCard.modifiedBy
|
||||
}
|
||||
|
||||
void control.domainRequest(control.ctx, 'communication' as OperationDomain, {
|
||||
await control.domainRequest(control.ctx, 'communication' as OperationDomain, {
|
||||
event
|
||||
})
|
||||
|
||||
@@ -366,7 +366,7 @@ async function OnCardUpdate (ctx: TxUpdateDoc<Card>[], control: TriggerControl):
|
||||
socialId: updateTx.createdBy ?? updateTx.modifiedBy,
|
||||
date: new Date(updateTx.createdOn ?? updateTx.modifiedOn)
|
||||
}
|
||||
void control.domainRequest(control.ctx, 'communication' as OperationDomain, {
|
||||
await control.domainRequest(control.ctx, 'communication' as OperationDomain, {
|
||||
event
|
||||
})
|
||||
}
|
||||
@@ -464,7 +464,7 @@ async function updateCollaborators (control: TriggerControl, ctx: TxCreateDoc<Ca
|
||||
socialId: tx.createdBy ?? tx.modifiedBy,
|
||||
date: new Date((tx.createdOn ?? tx.modifiedOn) + 1)
|
||||
}
|
||||
void control.domainRequest(control.ctx, 'communication' as OperationDomain, {
|
||||
await control.domainRequest(control.ctx, 'communication' as OperationDomain, {
|
||||
event
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user