mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 19:45:05 +01:00
also clear pending reaction promise when an error is thrown
This commit is contained in:
parent
1a5a64864a
commit
c585d76ce5
@ -142,6 +142,7 @@ export class BaseMessageTile extends SimpleTile {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const redaction = this._entry.getAnnotationPendingRedaction(key);
|
const redaction = this._entry.getAnnotationPendingRedaction(key);
|
||||||
|
try {
|
||||||
const updatePromise = new Promise(resolve => this._pendingReactionChangeCallback = resolve);
|
const updatePromise = new Promise(resolve => this._pendingReactionChangeCallback = resolve);
|
||||||
if (redaction && !redaction.pendingEvent.hasStartedSending) {
|
if (redaction && !redaction.pendingEvent.hasStartedSending) {
|
||||||
log.set("abort_redaction", true);
|
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 this._room.sendEvent("m.reaction", this._entry.annotate(key), null, log);
|
||||||
}
|
}
|
||||||
await updatePromise;
|
await updatePromise;
|
||||||
|
} finally {
|
||||||
this._pendingReactionChangeCallback = null;
|
this._pendingReactionChangeCallback = null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
redactReaction(key, log = null) {
|
redactReaction(key, log = null) {
|
||||||
return this.logger.wrapOrRun(log, "redactReaction", log => {
|
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);
|
const entry = await this._entry.getOwnAnnotationEntry(this._timeline, key);
|
||||||
if (entry) {
|
if (entry) {
|
||||||
|
try {
|
||||||
const updatePromise = new Promise(resolve => this._pendingReactionChangeCallback = resolve);
|
const updatePromise = new Promise(resolve => this._pendingReactionChangeCallback = resolve);
|
||||||
await this._room.sendRedaction(entry.id, null, log);
|
await this._room.sendRedaction(entry.id, null, log);
|
||||||
await updatePromise;
|
await updatePromise;
|
||||||
|
} finally {
|
||||||
this._pendingReactionChangeCallback = null;
|
this._pendingReactionChangeCallback = null;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
log.set("no_reaction", true);
|
log.set("no_reaction", true);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user