File tree 2 files changed +10
-1
lines changed
crypto/verification/request
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -350,3 +350,11 @@ export interface GeneratedSas {
350
350
* English name.
351
351
*/
352
352
export type EmojiMapping = [ emoji : string , name : string ] ;
353
+
354
+ /**
355
+ * True if the request is in a state where it can be accepted (ie, that we're in phases {@link VerificationPhase.Unsent}
356
+ * or {@link VerificationPhase.Requested}, and that we're not in the process of sending a `ready` or `cancel`).
357
+ */
358
+ export function canAcceptVerificationRequest ( req : VerificationRequest ) : boolean {
359
+ return req . phase < VerificationPhase . Ready && ! req . accepting && ! req . declining ;
360
+ }
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ import { VerificationBase } from "../Base";
25
25
import { VerificationMethod } from "../../index" ;
26
26
import { TypedEventEmitter } from "../../../models/typed-event-emitter" ;
27
27
import {
28
+ canAcceptVerificationRequest ,
28
29
VerificationPhase as Phase ,
29
30
VerificationRequest as IVerificationRequest ,
30
31
VerificationRequestEvent ,
@@ -248,7 +249,7 @@ export class VerificationRequest<C extends IVerificationChannel = IVerificationC
248
249
}
249
250
250
251
public get canAccept ( ) : boolean {
251
- return this . phase < PHASE_READY && ! this . _accepting && ! this . _declining ;
252
+ return canAcceptVerificationRequest ( this ) ;
252
253
}
253
254
254
255
public get accepting ( ) : boolean {
You can’t perform that action at this time.
0 commit comments