From e6ab1e3df58639686b3d9d0e15d440e1c0973688 Mon Sep 17 00:00:00 2001 From: iequidoo Date: Fri, 29 Aug 2025 15:42:17 -0300 Subject: [PATCH] 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. --- src/contact.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/contact.rs b/src/contact.rs index 09c5b889c..a9925a04f 100644 --- a/src/contact.rs +++ b/src/contact.rs @@ -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(()) })