Inline VerificationRequest.{invalid,ready,started,done,cancelled}
(#11013)
* Inline `VerificationRequest.{invalid,ready,started,done,cancelled}` These methods are all just shortcuts for checks on `phase`, so let's get rid of them * update test * Add some more tests * even more coverage * fix tests
This commit is contained in:
parent
6fa005dcfc
commit
2801afe570
7 changed files with 210 additions and 35 deletions
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
import EventEmitter from "events";
|
||||
import {
|
||||
PHASE_DONE as VERIF_PHASE_DONE,
|
||||
Phase as VerificationPhase,
|
||||
VerificationRequest,
|
||||
VerificationRequestEvent,
|
||||
} from "matrix-js-sdk/src/crypto/verification/request/VerificationRequest";
|
||||
|
@ -178,7 +179,7 @@ export class SetupEncryptionStore extends EventEmitter {
|
|||
};
|
||||
|
||||
public onVerificationRequestChange = async (): Promise<void> => {
|
||||
if (this.verificationRequest?.cancelled) {
|
||||
if (this.verificationRequest?.phase === VerificationPhase.Cancelled) {
|
||||
this.verificationRequest.off(VerificationRequestEvent.Change, this.onVerificationRequestChange);
|
||||
this.verificationRequest = null;
|
||||
this.emit("update");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue