From 105c201ac31a7fe9afb996a267b216b4b62b7284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Gon=C3=A7alves=20Marchi?= Date: Wed, 25 Sep 2024 16:06:34 -0300 Subject: [PATCH] fix(Sibedar): Fix chat preview order on sidebar (#618) Co-authored-by: Sara Tavares <29093946+stavares843@users.noreply.github.com> Co-authored-by: Phill Wisniewski <93608357+phillsatellite@users.noreply.github.com> --- src/routes/files/+page.svelte | 6 +++++- src/routes/friends/+page.svelte | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/routes/files/+page.svelte b/src/routes/files/+page.svelte index adfa55095..339cc1721 100644 --- a/src/routes/files/+page.svelte +++ b/src/routes/files/+page.svelte @@ -521,7 +521,11 @@ {#if activeTabRoute === "chats"} - {#each $chats as chat} + {#each $chats.slice().sort((a, b) => { + const dateA = new Date(a.last_message_at || 0) + const dateB = new Date(b.last_message_at || 0) + return dateB.getTime() - dateA.getTime() + }) as chat} - {#each chats as chat} + {#each chats.slice().sort((a, b) => { + const dateA = new Date(a.last_message_at || 0) + const dateB = new Date(b.last_message_at || 0) + return dateB.getTime() - dateA.getTime() + }) as chat}