Skip to content

Commit e6ab1e3

Browse files
committed
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.
1 parent 5da6976 commit e6ab1e3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/contact.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,7 +1961,7 @@ pub(crate) async fn mark_contact_id_as_verified(
19611961
verifier_id,
19621962
"Contact cannot be verified by self",
19631963
);
1964-
let update = verifier_id == Some(ContactId::SELF);
1964+
let by_self = verifier_id == Some(ContactId::SELF);
19651965
let mut verifier_id = verifier_id.unwrap_or(contact_id);
19661966
context
19671967
.sql
@@ -2000,8 +2000,8 @@ pub(crate) async fn mark_contact_id_as_verified(
20002000
}
20012001
transaction.execute(
20022002
"UPDATE contacts SET verifier=?1
2003-
WHERE id=?2 AND (verifier=0 OR ?3)",
2004-
(verifier_id, contact_id, update),
2003+
WHERE id=?2 AND (verifier=0 OR verifier=id OR ?3)",
2004+
(verifier_id, contact_id, by_self),
20052005
)?;
20062006
Ok(())
20072007
})

0 commit comments

Comments
 (0)