From ef7d195580391401bf3ee8a48da677229b6a01f7 Mon Sep 17 00:00:00 2001 From: Erik Demaine Date: Tue, 21 Nov 2023 12:57:41 -0500 Subject: [PATCH] Fix search sorting precedence --- client/search.coffee | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/client/search.coffee b/client/search.coffee index 9e2159a..098d450 100644 --- a/client/search.coffee +++ b/client/search.coffee @@ -19,13 +19,14 @@ messagesSearch = (group, search) -> topMessagesSearch = (group, search) -> msgs = messagesSearch group, search return [] unless msgs? + ## Least significant: sort by increasing creation time msgs = msgs.fetch() - ## Least significant: sort by group's default sort order -- - ## applying sort to message root, not the message - msgs = messagesSortedBy msgs, groupDefaultSort(group), findMessageRoot ## Middle significant: sort roots before their descendants msgs = _.sortBy msgs, (msg) -> msg.root? - ## Most significant: sort by group name + ## Most significant: sort by group's default sort order -- + ## applying sort to message root, not the message + msgs = messagesSortedBy msgs, groupDefaultSort(group), findMessageRoot + ## Mostest significant: sort by group name msgs = _.sortBy msgs, 'group' ## Form a set of all message IDs in match byId = {}