From 2f92b7ef87e5f67b5f01f5e0f43a2784542e5cf4 Mon Sep 17 00:00:00 2001 From: teodorus-nathaniel Date: Fri, 12 Jul 2024 22:49:27 +0700 Subject: [PATCH] Change order by for paginated post --- src/services/datahub/posts/query.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/services/datahub/posts/query.ts b/src/services/datahub/posts/query.ts index d4f7355c5..4742ed613 100644 --- a/src/services/datahub/posts/query.ts +++ b/src/services/datahub/posts/query.ts @@ -111,7 +111,9 @@ async function getPaginatedPostIdsByRootPostId({ rootPostId: postId, approvedInRootPost: !onlyDisplayUnapprovedMessages, }, - orderBy: 'createdAtTime', + orderBy: onlyDisplayUnapprovedMessages + ? 'createdAtTime' + : 'approvedInRootPostAtTime', orderDirection: onlyDisplayUnapprovedMessages ? QueryOrder.Asc : QueryOrder.Desc,