Don't let blocking be bypassed using groups (#4316)

* Don't let blocking be bypassed using groups

Fix #4313

* Fix another bug: A blocked group was sometimes not unblocked when an unblocked contact sent a message into it.
This commit is contained in:
Hocuri
2023-04-13 22:45:47 +02:00
committed by GitHub
parent efd6937dfa
commit c6a64e8d93
4 changed files with 89 additions and 16 deletions

View File

@@ -18,7 +18,10 @@ use tokio::runtime::Handle;
use tokio::sync::RwLock;
use tokio::task;
use crate::chat::{self, Chat, ChatId, MessageListOptions};
use crate::chat::{
self, add_to_chat_contacts_table, create_group_chat, Chat, ChatId, MessageListOptions,
ProtectionStatus,
};
use crate::chatlist::Chatlist;
use crate::config::Config;
use crate::constants::Chattype;
@@ -702,6 +705,25 @@ impl TestContext {
);
}
}
pub async fn create_group_with_members(
&self,
protect: ProtectionStatus,
chat_name: &str,
members: &[&TestContext],
) -> ChatId {
let chat_id = create_group_chat(self, protect, chat_name).await.unwrap();
let mut to_add = vec![];
for member in members {
let contact = self.add_or_lookup_contact(member).await;
to_add.push(contact.id);
}
add_to_chat_contacts_table(self, chat_id, &to_add)
.await
.unwrap();
chat_id
}
}
impl Deref for TestContext {