fix: Handle the case that the user starts a securejoin, and then deletes the contact (#7883)

fix https://github.com/chatmail/core/issues/7880

depends on #7754 (merged)

With this change, a securejoin message is just ignored if the contact
was deleted in the meantime; apparently the user is not interested in
the securejoin process anymore if they deleted the contact.

But other, parallel securejoin processes must not be affected; the test
also tests this.
This commit is contained in:
Hocuri
2026-03-02 22:11:05 +01:00
committed by GitHub
parent b85fa84a37
commit ab08a47298
2 changed files with 33 additions and 11 deletions

View File

@@ -304,7 +304,9 @@ async fn verify_sender_by_fingerprint(
fingerprint: &Fingerprint,
contact_id: ContactId,
) -> Result<bool> {
let contact = Contact::get_by_id(context, contact_id).await?;
let Some(contact) = Contact::get_by_id_optional(context, contact_id).await? else {
return Ok(false);
};
let is_verified = contact.fingerprint().is_some_and(|fp| &fp == fingerprint);
if is_verified {
mark_contact_id_as_verified(context, contact_id, Some(ContactId::SELF)).await?;