Fix double tx apply with needResult true (#6585)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina 2024-09-16 16:02:28 +04:00 committed by GitHub
parent 9583f57cf0
commit ec6b6fb568
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View File

@ -60,13 +60,13 @@ export async function OnReactionChanged (originTx: Tx, control: TriggerControl):
if (innerTx._class === core.class.TxCreateDoc) {
const txes = await createReactionNotifications(tx, control)
await control.apply(control.ctx, txes, true)
await control.apply(control.ctx, txes)
return []
}
if (innerTx._class === core.class.TxRemoveDoc) {
const txes = await removeReactionNotifications(tx, control)
await control.apply(control.ctx, txes, true)
await control.apply(control.ctx, txes)
return []
}

View File

@ -99,7 +99,9 @@ export class Triggers {
ctx,
txFactory: null as any, // Will be set later
apply: async (ctx, tx, needResult) => {
apply.push(...tx)
if (needResult !== true) {
apply.push(...tx)
}
ctrl.txes.push(...tx) // We need to put them so other triggers could check if similar operation is already performed.
return await ctrl.apply(ctx, tx, needResult)
}