mirror of
https://github.com/chatmail/core.git
synced 2026-04-29 03:16:29 +03:00
fix: Sort system messages to the bottom of the chat
Fix #7435 For most messages, `calc_sort_timestamp()` makes sure that they are at the correct place; esp. that they are not above system messages or other noticed/seen messages. Most callers of `add_info_msg()`, however, didn't call `calc_sort_timestamp()`, and just used `time()` or `smeared_time()` to get the sort timestamp. Because of this, system messages could sometimes wrongly be sorted above other messages. This PR fixes this by making the sort timestamp optional in `add_info_msg*()`. If the sort timestamp isn't passed, then the message is sorted to the bottom of the chat. `sent_rcvd_timestamp` is not optional anymore, because we need _some_ timestamp that can be shown to the user (most callers just pass `time()` there).
This commit is contained in:
@@ -1777,11 +1777,16 @@ async fn add_parts(
|
||||
"Updated ephemeral timer to {ephemeral_timer:?} for chat {chat_id}."
|
||||
);
|
||||
if mime_parser.is_system_message != SystemMessage::EphemeralTimerChanged {
|
||||
chat::add_info_msg(
|
||||
chat::add_info_msg_with_cmd(
|
||||
context,
|
||||
chat_id,
|
||||
&stock_ephemeral_timer_changed(context, ephemeral_timer, from_id).await,
|
||||
sort_timestamp,
|
||||
SystemMessage::Unknown,
|
||||
Some(sort_timestamp),
|
||||
mime_parser.timestamp_sent,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
@@ -1889,8 +1894,8 @@ async fn add_parts(
|
||||
chat_id,
|
||||
&group_changes_msg,
|
||||
cmd,
|
||||
sort_timestamp,
|
||||
None,
|
||||
Some(sort_timestamp),
|
||||
mime_parser.timestamp_sent,
|
||||
None,
|
||||
None,
|
||||
added_removed_id,
|
||||
|
||||
Reference in New Issue
Block a user