From 1e4fcb3c79a90870241c762b632ea290b3430bc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Espino=20Garc=C3=ADa?= Date: Wed, 11 Dec 2024 15:04:39 +0100 Subject: [PATCH] Add missing changes --- .../operator/server_data_operator/transformers/thread.ts | 5 +++-- app/screens/global_threads/threads_list/index.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/database/operator/server_data_operator/transformers/thread.ts b/app/database/operator/server_data_operator/transformers/thread.ts index 19d170504d8..7846c98cefd 100644 --- a/app/database/operator/server_data_operator/transformers/thread.ts +++ b/app/database/operator/server_data_operator/transformers/thread.ts @@ -33,8 +33,9 @@ export const transformThreadRecord = ({action, database, value}: TransformerArgs const fieldsMapper = (thread: ThreadModel) => { thread._raw.id = isCreateAction ? (raw?.id ?? thread.id) : record.id; - // When post is individually fetched, we get last_reply_at as 0, so we use the record's value - thread.lastReplyAt = raw.last_reply_at || record?.lastReplyAt; + // When post is individually fetched, we get last_reply_at as 0, so we use the record's value. + // If there is no reply at, we default to the post's create_at + thread.lastReplyAt = raw.last_reply_at || record?.lastReplyAt || raw.post.create_at; thread.lastViewedAt = raw.last_viewed_at ?? record?.lastViewedAt ?? 0; thread.replyCount = raw.reply_count; diff --git a/app/screens/global_threads/threads_list/index.ts b/app/screens/global_threads/threads_list/index.ts index 93efdac8d22..cd52f200e7e 100644 --- a/app/screens/global_threads/threads_list/index.ts +++ b/app/screens/global_threads/threads_list/index.ts @@ -32,7 +32,7 @@ const enhanced = withObservables(['tab', 'teamId'], ({database, tab, teamId}: Pr threads: teamThreadsSyncObserver.pipe( switchMap((teamThreadsSync) => { const earliest = tab === 'all' ? teamThreadsSync?.[0]?.earliest : 0; - return queryThreadsInTeam(database, teamId, getOnlyUnreads, false, true, true, earliest).observe(); + return queryThreadsInTeam(database, teamId, getOnlyUnreads, true, true, true, earliest).observe(); }), ), };