mirror of
https://github.com/chatmail/core.git
synced 2026-05-04 13:56:30 +03:00
Sort message replies after parent message
This commit is contained in:
committed by
link2xt
parent
be922eef0f
commit
763334d0aa
@@ -698,6 +698,20 @@ async fn add_parts(
|
||||
let in_fresh = state == MessageState::InFresh;
|
||||
let rcvd_timestamp = time();
|
||||
let sort_timestamp = calc_sort_timestamp(context, *sent_timestamp, *chat_id, in_fresh).await;
|
||||
|
||||
// Ensure replies to messages are sorted after the parent message.
|
||||
//
|
||||
// This is useful in a case where sender clocks are not
|
||||
// synchronized and parent message has a Date: header with a
|
||||
// timestamp higher than reply timestamp.
|
||||
//
|
||||
// This does not help if parent message arrives later than the
|
||||
// reply.
|
||||
let parent_timestamp = mime_parser.get_parent_timestamp(context).await?;
|
||||
let sort_timestamp = parent_timestamp.map_or(sort_timestamp, |parent_timestamp| {
|
||||
std::cmp::max(sort_timestamp, parent_timestamp)
|
||||
});
|
||||
|
||||
*sent_timestamp = std::cmp::min(*sent_timestamp, rcvd_timestamp);
|
||||
|
||||
// unarchive chat
|
||||
|
||||
Reference in New Issue
Block a user