]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
over: re-sort Subject matches for WWW /T/ endpoint
authorEric Wong <e@80x24.org>
Mon, 1 Jan 2024 01:07:48 +0000 (01:07 +0000)
committerEric Wong <e@80x24.org>
Tue, 2 Jan 2024 18:39:39 +0000 (18:39 +0000)
When retrieving loose (Subject) matches for a thread, we wanted
the most recent matches in reverse chronological order.
However, when displaying the /T/ endpoint generating the thread
skeleton, we prefer ascending chronological order to match the
flow of the conversation.

Reported-by: Askar Safin <safinaskar@gmail.com>
Link: https://public-inbox.org/meta/CAPnZJGAqsh8ZhPaCAy5M2NZVNcWrr_Hr94t32VXiyiTXwD9jRQ@mail.gmail.com/
lib/PublicInbox/Over.pm

index 4eed4f469c4e3c743432742241fbf0ffe3b53a7b..3b7d49f52677bf4d01b64d9aea280be6d9e665a2 100644 (file)
@@ -200,6 +200,11 @@ ORDER BY $sort_col DESC
                # TODO separate strict and loose matches here once --reindex
                # is fixed to preserve `tid' properly
                push @$msgs, @$loose;
+
+               # we wanted to retrieve the latest loose messages; but preserve
+               # chronological ordering for threading /$INBOX/$MSGID/[tT]/
+               $sort_col eq 'ds' and
+                       @$msgs = sort { $a->{ds} <=> $b->{ds} } @$msgs;
        }
        ($nr, $msgs);
 }