also clear pending reaction promise when an error is thrown

This commit is contained in:
Bruno Windels 2021-06-23 17:47:47 +02:00
parent 1a5a64864a
commit c585d76ce5

View File

@ -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);
}