From 01fdd1f7d4b0e75f1dfc0961d36c5223d20bc200 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Espino=20Garc=C3=ADa?= Date: Thu, 26 Oct 2023 15:15:54 +0200 Subject: [PATCH] Fix recent sorting difference with webapp (#7632) --- app/utils/categories.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/utils/categories.ts b/app/utils/categories.ts index 7b2d3e604..91f9afadc 100644 --- a/app/utils/categories.ts +++ b/app/utils/categories.ts @@ -180,7 +180,9 @@ const sortChannelsByName = (notifyPropsPerChannel: Record>, locale: string) => { if (sorting === 'recent') { return channelsWithMyChannel.sort((cwmA, cwmB) => { - return cwmB.myChannel.lastPostAt - cwmA.myChannel.lastPostAt; + const a = Math.max(cwmA.myChannel.lastPostAt, cwmA.channel.createAt); + const b = Math.max(cwmB.myChannel.lastPostAt, cwmB.channel.createAt); + return b - a; }).map((cwm) => cwm.channel); } else if (sorting === 'manual') { return channelsWithMyChannel.sort((cwmA, cwmB) => {