Skip to content

Commit 3c29f69

Browse files
committed
feat: sort past members by the timestamp of removal
1 parent 96704eb commit 3c29f69

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/chat.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3493,6 +3493,8 @@ pub async fn get_chat_contacts(context: &Context, chat_id: ChatId) -> Result<Vec
34933493
}
34943494

34953495
/// Returns a vector of contact IDs for given chat ID that are no longer part of the group.
3496+
///
3497+
/// Members that have been removed recently are in the beginning of the list.
34963498
pub async fn get_past_chat_contacts(context: &Context, chat_id: ChatId) -> Result<Vec<ContactId>> {
34973499
let now = time();
34983500
let list = context
@@ -3505,7 +3507,7 @@ pub async fn get_past_chat_contacts(context: &Context, chat_id: ChatId) -> Resul
35053507
WHERE cc.chat_id=?
35063508
AND cc.add_timestamp < cc.remove_timestamp
35073509
AND ? < cc.remove_timestamp
3508-
ORDER BY c.id=1, c.last_seen DESC, c.id DESC",
3510+
ORDER BY c.id=1, cc.remove_timestamp DESC, c.id DESC",
35093511
(chat_id, now.saturating_sub(60 * 24 * 3600)),
35103512
|row| row.get::<_, ContactId>(0),
35113513
|ids| ids.collect::<Result<Vec<_>, _>>().map_err(Into::into),

0 commit comments

Comments
 (0)