mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 09:26:29 +03:00
Make sure the resetup happy path works
This commit is contained in:
@@ -1678,17 +1678,6 @@ async fn create_or_lookup_group(
|
|||||||
members.dedup();
|
members.dedup();
|
||||||
chat::add_to_chat_contacts_table(context, new_chat_id, &members).await?;
|
chat::add_to_chat_contacts_table(context, new_chat_id, &members).await?;
|
||||||
|
|
||||||
// once, we have protected-chats explained in UI, we can uncomment the following lines.
|
|
||||||
// ("verified groups" did not add a message anyway)
|
|
||||||
//
|
|
||||||
//if create_protected == ProtectionStatus::Protected {
|
|
||||||
// set from_id=0 as it is not clear that the sender of this random group message
|
|
||||||
// actually really has enabled chat-protection at some point.
|
|
||||||
//new_chat_id
|
|
||||||
// .add_protection_msg(context, ProtectionStatus::Protected, false, 0)
|
|
||||||
// .await?;
|
|
||||||
//}
|
|
||||||
|
|
||||||
context.emit_event(EventType::ChatModified(new_chat_id));
|
context.emit_event(EventType::ChatModified(new_chat_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1791,7 +1780,12 @@ async fn apply_group_changes(
|
|||||||
|
|
||||||
if !chat.is_protected() {
|
if !chat.is_protected() {
|
||||||
chat_id
|
chat_id
|
||||||
.inner_set_protection(context, ProtectionStatus::Protected)
|
.set_protection(
|
||||||
|
context,
|
||||||
|
ProtectionStatus::Protected,
|
||||||
|
smeared_time(context),
|
||||||
|
Some(from_id),
|
||||||
|
)
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2453,6 +2447,40 @@ async fn has_verified_encryption(
|
|||||||
if let Some(fp) = peerstate.gossip_key_fingerprint.clone() {
|
if let Some(fp) = peerstate.gossip_key_fingerprint.clone() {
|
||||||
peerstate.set_verified(PeerstateKeyType::GossipKey, fp, verifier_addr)?;
|
peerstate.set_verified(PeerstateKeyType::GossipKey, fp, verifier_addr)?;
|
||||||
peerstate.save_to_db(&context.sql).await?;
|
peerstate.save_to_db(&context.sql).await?;
|
||||||
|
|
||||||
|
// TODO check if in other places where set_verified() is used we should also
|
||||||
|
// also set the chat as verified (& create a hidden chat if necessary)
|
||||||
|
|
||||||
|
// TODO There is may be some code duplication with other code added recently
|
||||||
|
// and also some function should be extracted here because has_verified_encryption()
|
||||||
|
// is becoming very long and nested
|
||||||
|
if !is_verified {
|
||||||
|
let to_id = Contact::add_or_lookup(
|
||||||
|
context,
|
||||||
|
"",
|
||||||
|
ContactAddress::new(&to_addr)?,
|
||||||
|
Origin::Hidden,
|
||||||
|
)
|
||||||
|
.await?
|
||||||
|
.0;
|
||||||
|
let chat_id = ChatId::create_for_contact_with_blocked(
|
||||||
|
context,
|
||||||
|
to_id,
|
||||||
|
Blocked::Yes,
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.with_context(|| {
|
||||||
|
format!("can't create chat for contact {}", to_addr)
|
||||||
|
})?;
|
||||||
|
chat_id
|
||||||
|
.set_protection(
|
||||||
|
context,
|
||||||
|
ProtectionStatus::Protected,
|
||||||
|
smeared_time(context),
|
||||||
|
Some(to_id),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// The contact already has a verified key.
|
// The contact already has a verified key.
|
||||||
|
|||||||
Reference in New Issue
Block a user