-
-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Don't create ad-hoc group on a member removal message (#5618)
The "Chat-Group-Member-Removed" header is added to ad-hoc group messages as well, so we should check for its presense before creating an ad-hoc group as we do for DC-style groups.
- Loading branch information
Showing
2 changed files
with
41 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4620,6 +4620,33 @@ async fn test_protected_group_add_remove_member_missing_key() -> Result<()> { | |
Ok(()) | ||
} | ||
|
||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] | ||
async fn test_dont_create_adhoc_group_on_member_removal() -> Result<()> { | ||
let mut tcm = TestContextManager::new(); | ||
let bob = &tcm.bob().await; | ||
async fn get_chat_cnt(ctx: &Context) -> Result<usize> { | ||
ctx.sql | ||
.count("SELECT COUNT(*) FROM chats WHERE id>9", ()) | ||
.await | ||
} | ||
let chat_cnt = get_chat_cnt(bob).await?; | ||
receive_imf( | ||
bob, | ||
b"From: Alice <[email protected]>\n\ | ||
To: <[email protected]>, <[email protected]>\n\ | ||
Chat-Version: 1.0\n\ | ||
Subject: subject\n\ | ||
Message-ID: <[email protected]>\n\ | ||
Date: Sun, 14 Nov 2021 00:10:00 +0000\ | ||
Content-Type: text/plain | ||
Chat-Group-Member-Removed: [email protected]", | ||
false, | ||
) | ||
.await?; | ||
assert_eq!(get_chat_cnt(bob).await?, chat_cnt); | ||
Ok(()) | ||
} | ||
|
||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] | ||
async fn test_forged_from() -> Result<()> { | ||
let mut tcm = TestContextManager::new(); | ||
|