You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-29 16:43:09 +03:00
Merge pull request #1302 from matrix-org/bwindels/selfverifux
Add isSelfVerification property to VerificationRequest
This commit is contained in:
@@ -302,6 +302,10 @@ export class VerificationRequest extends EventEmitter {
|
|||||||
return this.channel.userId;
|
return this.channel.userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get isSelfVerification() {
|
||||||
|
return this._client.getUserId() === this.otherUserId;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The id of the user that cancelled the request,
|
* The id of the user that cancelled the request,
|
||||||
* only defined when phase is PHASE_CANCELLED
|
* only defined when phase is PHASE_CANCELLED
|
||||||
@@ -589,10 +593,9 @@ export class VerificationRequest extends EventEmitter {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const oldEvent = this._verifier.startEvent;
|
const oldEvent = this._verifier.startEvent;
|
||||||
const isSelfVerification = this.channel.userId === this._client.getUserId();
|
|
||||||
|
|
||||||
let oldRaceIdentifier;
|
let oldRaceIdentifier;
|
||||||
if (isSelfVerification) {
|
if (this.isSelfVerification) {
|
||||||
// if the verifier does not have a startEvent,
|
// if the verifier does not have a startEvent,
|
||||||
// it is because it's still sending and we are on the initator side
|
// it is because it's still sending and we are on the initator side
|
||||||
// we know we are sending a .start event because we already
|
// we know we are sending a .start event because we already
|
||||||
@@ -612,7 +615,7 @@ export class VerificationRequest extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let newRaceIdentifier;
|
let newRaceIdentifier;
|
||||||
if (isSelfVerification) {
|
if (this.isSelfVerification) {
|
||||||
const newContent = newEvent.getContent();
|
const newContent = newEvent.getContent();
|
||||||
newRaceIdentifier = newContent && newContent.from_device;
|
newRaceIdentifier = newContent && newContent.from_device;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user