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