You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-12-01 04:43:29 +03:00
Merge pull request #1226 from matrix-org/bwindels/dontfailonhistoricalcancelafterstart
don't assume verify has been called when receiving a cancellation in verifier
This commit is contained in:
@@ -155,10 +155,13 @@ export class VerificationBase extends EventEmitter {
|
|||||||
} else if (e.getType() === "m.key.verification.cancel") {
|
} else if (e.getType() === "m.key.verification.cancel") {
|
||||||
const reject = this._reject;
|
const reject = this._reject;
|
||||||
this._reject = undefined;
|
this._reject = undefined;
|
||||||
|
// there is only promise to reject if verify has been called
|
||||||
|
if (reject) {
|
||||||
const content = e.getContent();
|
const content = e.getContent();
|
||||||
const {reason, code} = content;
|
const {reason, code} = content;
|
||||||
reject(new Error(`Other side cancelled verification ` +
|
reject(new Error(`Other side cancelled verification ` +
|
||||||
`because ${reason} (${code})`));
|
`because ${reason} (${code})`));
|
||||||
|
}
|
||||||
} else if (this._expectedEvent) {
|
} else if (this._expectedEvent) {
|
||||||
// only cancel if there is an event expected.
|
// only cancel if there is an event expected.
|
||||||
// if there is no event expected, it means verify() wasn't called
|
// if there is no event expected, it means verify() wasn't called
|
||||||
|
|||||||
Reference in New Issue
Block a user