mirror of
https://github.com/chatmail/core.git
synced 2026-05-03 21:36:29 +03:00
fix: Update verifier_id if it's "unknown" and new verifier has known verifier
Now that the previous commit avoids creating incorrect reverse verification chains, we can do this. Sure, existing users' dbs aready have verification chains ending with "unknown" roots, but at least for new users updating `verifier_id` to a known verifier makes sense.
This commit is contained in:
@@ -1961,7 +1961,7 @@ pub(crate) async fn mark_contact_id_as_verified(
|
||||
verifier_id,
|
||||
"Contact cannot be verified by self",
|
||||
);
|
||||
let update = verifier_id == Some(ContactId::SELF);
|
||||
let by_self = verifier_id == Some(ContactId::SELF);
|
||||
let mut verifier_id = verifier_id.unwrap_or(contact_id);
|
||||
context
|
||||
.sql
|
||||
@@ -2000,8 +2000,8 @@ pub(crate) async fn mark_contact_id_as_verified(
|
||||
}
|
||||
transaction.execute(
|
||||
"UPDATE contacts SET verifier=?1
|
||||
WHERE id=?2 AND (verifier=0 OR ?3)",
|
||||
(verifier_id, contact_id, update),
|
||||
WHERE id=?2 AND (verifier=0 OR verifier=id OR ?3)",
|
||||
(verifier_id, contact_id, by_self),
|
||||
)?;
|
||||
Ok(())
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user