]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/View.pm
consolidate thread sorting in view
[public-inbox.git] / lib / PublicInbox / View.pm
index ee5ba20e2a91e7b15dfd1ae6e3243fad167ba294..68adbd72840592dccb87cc1e37c151eb4b4795c9 100644 (file)
@@ -662,7 +662,7 @@ sub thread_results {
        no warnings 'once';
        $Mail::Thread::nosubject = $nosubject;
        $th->thread;
-       $th->order(*PublicInbox::Thread::sort_ts);
+       $th->order(*sort_ts);
        $th
 }
 
@@ -747,6 +747,13 @@ sub inline_dump {
        inline_dump($dst, $state, $upfx, $node->next, $level);
 }
 
+sub sort_ts {
+       sort {
+               (eval { $a->topmost->message->header('X-PI-TS') } || 0) <=>
+               (eval { $b->topmost->message->header('X-PI-TS') } || 0)
+       } @_;
+}
+
 sub rsort_ts {
        sort {
                (eval { $b->topmost->message->header('X-PI-TS') } || 0) <=>