]> Sergey Matveev's repositories - public-inbox.git/commitdiff
consolidate thread sorting in view
authorEric Wong <e@80x24.org>
Fri, 4 Sep 2015 02:18:07 +0000 (02:18 +0000)
committerEric Wong <e@80x24.org>
Fri, 4 Sep 2015 02:19:02 +0000 (02:19 +0000)
This is a display subroutine so it should not be in our thread
monkey-patching package, but instead in the view package.

Hopefully one day in the future, Mail::Thread will be maintained
again and we'll no longer need PublicInbox::Thread at all.

lib/PublicInbox/Thread.pm
lib/PublicInbox/View.pm

index a3dedf541cb592a0e23182ac5c7dbd91736d49ca..781fffff2d5806d05390b66288c413a011745590 100644 (file)
@@ -17,13 +17,6 @@ if ($Mail::Thread::VERSION <= 2.55) {
        eval q(sub _container_class { 'PublicInbox::Thread::Container' });
 }
 
-sub sort_ts {
-       sort {
-               (eval { $a->topmost->message->header('X-PI-TS') } || 0) <=>
-               (eval { $b->topmost->message->header('X-PI-TS') } || 0)
-       } @_;
-}
-
 package PublicInbox::Thread::Container;
 use strict;
 use warnings;
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) <=>