Don't double cancel verification request - #1064
Conversation
d8b50c4 to
37558ac
Compare
| this._resetTimer(); | ||
| this._resolveEvent(e); | ||
| } else if (e.getType() === "m.key.verification.cancel") { | ||
| const reject = this._reject; |
There was a problem hiding this comment.
I think that if you just do a this.cancel(e), then it should do the right thing, because the cancel function says that it handles cancellations from the other user (if it gets passed a MatrixEvent). Though we probably also want to call this._rejectEvent if it's defined, so it may be better to just stick this in with the else clause, and assign to exception based on whether e.getType() === "m.key.verification.cancel".
Though it looks like the else clause isn't doing the right thing right now, because it really should be causing the client to send an m.key.verification.cancel with code set to m.unexpected_message. So, I think if you do something like
const exception = e.getType() === "m.key.verification.cancel" ? e : newUnexpectedMessageError();in the else clause (you'll need to import newUnexpectedMessageError from Error.js), then it should fix that and the double-cancel issue.
There was a problem hiding this comment.
Hmm, I tried calling _rejectEvent, but that made it send an m.key.verification.cancel event like before. Will have another look
This fixes the verifier not handling incoming
m.key.verification.cancelevents, and just treating them as unexpected and sending am.key.verification.cancelevent of its own with an error. These doublem.key.verification.cancelevents make it harder to detect which user actually pressed cancel.Initial PR for verification over DM was #1050