mirror of
https://github.com/chatmail/core.git
synced 2026-05-24 17:26:30 +03:00
fix: Mark 1:1 chat as protected when joining a group
This commit is contained in:
@@ -28,7 +28,6 @@ def test_qr_setup_contact(acfactory) -> None:
|
|||||||
assert alice_contact_bob_snapshot.is_profile_verified
|
assert alice_contact_bob_snapshot.is_profile_verified
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.xfail()
|
|
||||||
def test_qr_securejoin(acfactory):
|
def test_qr_securejoin(acfactory):
|
||||||
alice, bob = acfactory.get_online_accounts(2)
|
alice, bob = acfactory.get_online_accounts(2)
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use percent_encoding::{utf8_percent_encode, AsciiSet, NON_ALPHANUMERIC};
|
|||||||
use crate::aheader::EncryptPreference;
|
use crate::aheader::EncryptPreference;
|
||||||
use crate::chat::{self, Chat, ChatId, ChatIdBlocked, ProtectionStatus};
|
use crate::chat::{self, Chat, ChatId, ChatIdBlocked, ProtectionStatus};
|
||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
use crate::constants::{Blocked, Chattype};
|
use crate::constants::Blocked;
|
||||||
use crate::contact::{Contact, ContactId, Origin};
|
use crate::contact::{Contact, ContactId, Origin};
|
||||||
use crate::context::Context;
|
use crate::context::Context;
|
||||||
use crate::e2ee::ensure_secret_key_exists;
|
use crate::e2ee::ensure_secret_key_exists;
|
||||||
@@ -684,17 +684,17 @@ async fn secure_connection_established(
|
|||||||
.get_config_bool(Config::VerifiedOneOnOneChats)
|
.get_config_bool(Config::VerifiedOneOnOneChats)
|
||||||
.await?
|
.await?
|
||||||
{
|
{
|
||||||
let chat = Chat::load_from_db(context, chat_id).await?;
|
let private_chat_id = ChatIdBlocked::get_for_contact(context, contact_id, Blocked::Yes)
|
||||||
if chat.typ == Chattype::Single {
|
.await?
|
||||||
chat_id
|
.id;
|
||||||
.set_protection(
|
private_chat_id
|
||||||
context,
|
.set_protection(
|
||||||
ProtectionStatus::Protected,
|
context,
|
||||||
time(),
|
ProtectionStatus::Protected,
|
||||||
Some(contact_id),
|
time(),
|
||||||
)
|
Some(contact_id),
|
||||||
.await?;
|
)
|
||||||
}
|
.await?;
|
||||||
}
|
}
|
||||||
context.emit_event(EventType::ChatModified(chat_id));
|
context.emit_event(EventType::ChatModified(chat_id));
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -228,9 +228,8 @@ impl BobState {
|
|||||||
if context
|
if context
|
||||||
.get_config_bool(Config::VerifiedOneOnOneChats)
|
.get_config_bool(Config::VerifiedOneOnOneChats)
|
||||||
.await?
|
.await?
|
||||||
&& chat_id == self.alice_chat()
|
|
||||||
{
|
{
|
||||||
chat_id
|
self.alice_chat()
|
||||||
.set_protection(
|
.set_protection(
|
||||||
context,
|
context,
|
||||||
ProtectionStatus::Protected,
|
ProtectionStatus::Protected,
|
||||||
|
|||||||
Reference in New Issue
Block a user