fix: Mark 1:1 chat as protected when joining a group

This commit is contained in:
Hocuri
2023-11-08 16:13:39 +01:00
committed by link2xt
parent 391cffb454
commit 3e194969c0
3 changed files with 13 additions and 15 deletions

View File

@@ -28,7 +28,6 @@ def test_qr_setup_contact(acfactory) -> None:
assert alice_contact_bob_snapshot.is_profile_verified
@pytest.mark.xfail()
def test_qr_securejoin(acfactory):
alice, bob = acfactory.get_online_accounts(2)

View File

@@ -8,7 +8,7 @@ use percent_encoding::{utf8_percent_encode, AsciiSet, NON_ALPHANUMERIC};
use crate::aheader::EncryptPreference;
use crate::chat::{self, Chat, ChatId, ChatIdBlocked, ProtectionStatus};
use crate::config::Config;
use crate::constants::{Blocked, Chattype};
use crate::constants::Blocked;
use crate::contact::{Contact, ContactId, Origin};
use crate::context::Context;
use crate::e2ee::ensure_secret_key_exists;
@@ -684,17 +684,17 @@ async fn secure_connection_established(
.get_config_bool(Config::VerifiedOneOnOneChats)
.await?
{
let chat = Chat::load_from_db(context, chat_id).await?;
if chat.typ == Chattype::Single {
chat_id
.set_protection(
context,
ProtectionStatus::Protected,
time(),
Some(contact_id),
)
.await?;
}
let private_chat_id = ChatIdBlocked::get_for_contact(context, contact_id, Blocked::Yes)
.await?
.id;
private_chat_id
.set_protection(
context,
ProtectionStatus::Protected,
time(),
Some(contact_id),
)
.await?;
}
context.emit_event(EventType::ChatModified(chat_id));
Ok(())

View File

@@ -228,9 +228,8 @@ impl BobState {
if context
.get_config_bool(Config::VerifiedOneOnOneChats)
.await?
&& chat_id == self.alice_chat()
{
chat_id
self.alice_chat()
.set_protection(
context,
ProtectionStatus::Protected,