Skip to content

Commit

Permalink
Fix search sorting precedence
Browse files Browse the repository at this point in the history
  • Loading branch information
edemaine committed Nov 21, 2023
1 parent 73d27f0 commit ef7d195
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions client/search.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down

0 comments on commit ef7d195

Please sign in to comment.