Fix: handle accepted contact verifaction if persistedVR is null (#4918)

This commit is contained in:
Mikhail Rogachev 2024-03-14 20:56:26 +01:00 committed by GitHub
parent baed7b9d83
commit 0aa1fb9eff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 8 deletions

View File

@ -869,20 +869,20 @@ func (m *Messenger) HandleAcceptContactVerification(state *ReceivedMessageState,
return err return err
} }
if persistedVR != nil && persistedVR.RepliedAt > request.Clock {
return nil // older message, ignore it
}
if persistedVR.RequestStatus == verification.RequestStatusCANCELED {
return nil // Do nothing, We have already cancelled the verification request
}
if persistedVR == nil { if persistedVR == nil {
// This is a response for which we have not received its request before // This is a response for which we have not received its request before
persistedVR = &verification.Request{} persistedVR = &verification.Request{}
persistedVR.ID = request.Id persistedVR.ID = request.Id
persistedVR.From = contactID persistedVR.From = contactID
persistedVR.To = myPubKey persistedVR.To = myPubKey
} else {
if persistedVR.RepliedAt > request.Clock {
return nil // older message, ignore it
}
if persistedVR.RequestStatus == verification.RequestStatusCANCELED {
return nil // Do nothing, We have already cancelled the verification request
}
} }
persistedVR.RequestStatus = verification.RequestStatusACCEPTED persistedVR.RequestStatus = verification.RequestStatusACCEPTED