-
-
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: Sort received outgoing message down if it's fresher than all no…
…n fresh messages Received messages shouldn't mingle with just sent ones and appear somewhere in the middle of the chat, so we go after the newest non fresh message. But if a received outgoing message is older than some `InSeen` message, better sort the received message purely by timestamp (this is an heuristic in order not to break the Gmail-like case simulated by `verified_chats::test_old_message_4()`). We could place the received message just before that `InSeen` message, but anyway the user may not notice it. At least this fixes outgoing messages sorting for shared accounts where messages from other devices should be sorted the same way as incoming ones.
- Loading branch information
Showing
5 changed files
with
68 additions
and
14 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
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 |
---|---|---|
|
@@ -4811,6 +4811,36 @@ async fn test_protected_group_add_remove_member_missing_key() -> Result<()> { | |
Ok(()) | ||
} | ||
|
||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] | ||
async fn test_older_message_from_2nd_device() -> Result<()> { | ||
let mut tcm = TestContextManager::new(); | ||
let alice = &tcm.alice().await; | ||
let chat_id = alice | ||
.create_chat_with_contact("", "[email protected]") | ||
.await | ||
.id; | ||
alice.send_text(chat_id, "We share this account").await; | ||
let received = receive_imf( | ||
alice, | ||
b"From: [email protected]\n\ | ||
To: [email protected]\n\ | ||
Message-ID: <[email protected]>\n\ | ||
Date: Sat, 07 Dec 1970 19:00:26 +0000\n\ | ||
\n\ | ||
I'm Alice too\n", | ||
true, | ||
) | ||
.await? | ||
.unwrap(); | ||
alice | ||
.golden_test_chat( | ||
received.chat_id, | ||
"receive_imf_older_message_from_2nd_device", | ||
) | ||
.await; | ||
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(); | ||
|
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Single#Chat#10: [email protected] [[email protected]] | ||
-------------------------------------------------------------------------------- | ||
Msg#10: Me (Contact#Contact#Self): We share this account √ | ||
Msg#11: Me (Contact#Contact#Self): I'm Alice too √ | ||
-------------------------------------------------------------------------------- |