fix: Don't reverify contacts by SELF on receipt of a message from another device

Also verify not yet verified contacts w/o setting a verifier for them (in the db it's stored as
`verifier_id=id` though) because we don't know who verified them for another device.
This commit is contained in:
iequidoo
2025-08-28 04:18:26 -03:00
committed by iequidoo
parent 9f1107c0e7
commit 61633cf23b
6 changed files with 41 additions and 9 deletions

View File

@@ -3691,12 +3691,13 @@ async fn mark_recipients_as_verified(
if mimeparser.get_header(HeaderDef::ChatVerified).is_none() {
return Ok(());
}
let verifier_id = Some(from_id).filter(|&id| id != ContactId::SELF);
for to_id in to_ids.iter().filter_map(|&x| x) {
if to_id == ContactId::SELF || to_id == from_id {
continue;
}
mark_contact_id_as_verified(context, to_id, from_id).await?;
mark_contact_id_as_verified(context, to_id, verifier_id).await?;
ChatId::set_protection_for_contact(context, to_id, mimeparser.timestamp_sent).await?;
}