From a9f07bcb6095dfc8df61d795871f8b673339ee9b Mon Sep 17 00:00:00 2001 From: automated-signal <37887102+automated-signal@users.noreply.github.com> Date: Wed, 17 Jun 2026 17:31:24 -0500 Subject: [PATCH] Fix document ordering in All Media gallery Co-authored-by: trevor-signal <131492920+trevor-signal@users.noreply.github.com> --- ts/sql/Server.node.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/ts/sql/Server.node.ts b/ts/sql/Server.node.ts index 63eb7b408e..07c29983ef 100644 --- a/ts/sql/Server.node.ts +++ b/ts/sql/Server.node.ts @@ -323,7 +323,6 @@ const { omit, partition, pick, - sortBy, } = lodash; type ConversationRow = Readonly<{ @@ -5818,13 +5817,15 @@ function getSortedDocuments( type: 'contacts', }) as Array; - return sortBy( - (documents as Array).concat( - contacts - ), - [raw => raw.message.receivedAt, raw => raw.message.sentAt], - ['DESC', 'DESC'] - ).slice(0, options.limit); + return lodash + .orderBy( + (documents as Array).concat( + contacts + ), + [raw => raw.message.receivedAt, raw => raw.message.sentAt], + ['desc', 'desc'] + ) + .slice(0, options.limit); })(); }