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 <[email protected]>
Link: 
https://public-inbox.org/meta/capnzjgaqsh8zhpacay5m2nzvncwrr_hr94t32vxiyitxwd9...@mail.gmail.com/
---
 lib/PublicInbox/Over.pm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/PublicInbox/Over.pm b/lib/PublicInbox/Over.pm
index 4eed4f46..3b7d49f5 100644
--- a/lib/PublicInbox/Over.pm
+++ b/lib/PublicInbox/Over.pm
@@ -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);
 }

Reply via email to