forked from mystiq/hydrogen-web
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,15 +142,18 @@ export class BaseMessageTile extends SimpleTile {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const redaction = this._entry.getAnnotationPendingRedaction(key);
|
const redaction = this._entry.getAnnotationPendingRedaction(key);
|
||||||
const updatePromise = new Promise(resolve => this._pendingReactionChangeCallback = resolve);
|
try {
|
||||||
if (redaction && !redaction.pendingEvent.hasStartedSending) {
|
const updatePromise = new Promise(resolve => this._pendingReactionChangeCallback = resolve);
|
||||||
log.set("abort_redaction", true);
|
if (redaction && !redaction.pendingEvent.hasStartedSending) {
|
||||||
await redaction.pendingEvent.abort();
|
log.set("abort_redaction", true);
|
||||||
} else {
|
await redaction.pendingEvent.abort();
|
||||||
await this._room.sendEvent("m.reaction", this._entry.annotate(key), null, log);
|
} 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) {
|
redactReaction(key, log = null) {
|
||||||
|
@ -171,15 +174,18 @@ export class BaseMessageTile extends SimpleTile {
|
||||||
log.set("ongoing", true);
|
log.set("ongoing", true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
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 {
|
|
||||||
log.set("no_reaction", true);
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log.set("no_reaction", true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_updateReactions() {
|
_updateReactions() {
|
||||||
|
|
Loading…
Reference in a new issue