From c7deee23dfc39d67407992381e7818bfd26233fa Mon Sep 17 00:00:00 2001 From: link2xt Date: Fri, 27 Mar 2026 21:02:59 +0100 Subject: [PATCH] fix: sort "member added" to the end of the chat --- src/receive_imf.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/receive_imf.rs b/src/receive_imf.rs index 7468f6562..9885b6d86 100644 --- a/src/receive_imf.rs +++ b/src/receive_imf.rs @@ -1835,6 +1835,16 @@ async fn add_parts( } } + // Sort message to the bottom if we are not in the chat + // so if we are added via QR code scan + // the message about our addition goes after all the info messages. + // Info messages are sorted by local smeared_timestamp() + // which advances quickly during SecureJoin, + // while "member added" message may have older timestamp + // corresponding to the sender clock. + // In practice inviter clock may even be slightly in the past. + let sort_to_bottom = !chat.is_self_in_chat(context).await?; + let is_location_kml = mime_parser.location_kml.is_some(); let mut group_changes = match chat.typ { _ if chat.id.is_special() => GroupChangesInfo::default(), @@ -1885,7 +1895,6 @@ async fn add_parts( }; let in_fresh = state == MessageState::InFresh; - let sort_to_bottom = false; let sort_timestamp = chat_id .calc_sort_timestamp(context, mime_parser.timestamp_sent, sort_to_bottom) .await?;