mirror of
https://github.com/chatmail/core.git
synced 2026-04-28 10:56:29 +03:00
fix: always sort "Messages are end-to-end encrypted" notice to the beginning
We set timestamp of this info message to 0 to make it always appear in the beginning of the chat. To avoid new chats being sorted to the end of the chatlist, we ignore such 0 and use chat creation timestamp when sorting the chatlist.
This commit is contained in:
@@ -477,12 +477,17 @@ impl ChatId {
|
||||
/// Adds message "Messages are end-to-end encrypted".
|
||||
pub(crate) async fn add_e2ee_notice(self, context: &Context, timestamp: i64) -> Result<()> {
|
||||
let text = stock_str::messages_e2ee_info_msg(context);
|
||||
|
||||
// Sort this notice to the very beginning of the chat.
|
||||
// We don't want any message to appear before this notice
|
||||
// which is normally added when encrypted chat is created.
|
||||
let sort_timestamp = 0;
|
||||
add_info_msg_with_cmd(
|
||||
context,
|
||||
self,
|
||||
&text,
|
||||
SystemMessage::ChatE2ee,
|
||||
Some(timestamp),
|
||||
Some(sort_timestamp),
|
||||
timestamp,
|
||||
None,
|
||||
None,
|
||||
|
||||
Reference in New Issue
Block a user