also clear pending reaction promise when an error is thrown
This commit is contained in:
parent
1a5a64864a
commit
c585d76ce5
1 changed files with 18 additions and 12 deletions
|
@ -142,6 +142,7 @@ export class BaseMessageTile extends SimpleTile {
|
|||
return;
|
||||
}
|
||||
const redaction = this._entry.getAnnotationPendingRedaction(key);
|
||||
try {
|
||||
const updatePromise = new Promise(resolve => this._pendingReactionChangeCallback = resolve);
|
||||
if (redaction && !redaction.pendingEvent.hasStartedSending) {
|
||||
log.set("abort_redaction", true);
|
||||
|
@ -150,8 +151,10 @@ export class BaseMessageTile extends SimpleTile {
|
|||
await this._room.sendEvent("m.reaction", this._entry.annotate(key), null, log);
|
||||
}
|
||||
await updatePromise;
|
||||
} finally {
|
||||
this._pendingReactionChangeCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
redactReaction(key, log = null) {
|
||||
return this.logger.wrapOrRun(log, "redactReaction", log => {
|
||||
|
@ -173,10 +176,13 @@ export class BaseMessageTile extends SimpleTile {
|
|||
}
|
||||
const entry = await this._entry.getOwnAnnotationEntry(this._timeline, key);
|
||||
if (entry) {
|
||||
try {
|
||||
const updatePromise = new Promise(resolve => this._pendingReactionChangeCallback = resolve);
|
||||
await this._room.sendRedaction(entry.id, null, log);
|
||||
await updatePromise;
|
||||
} finally {
|
||||
this._pendingReactionChangeCallback = null;
|
||||
}
|
||||
} else {
|
||||
log.set("no_reaction", true);
|
||||
}
|
||||
|
|
Reference in a new issue