From 16d1d110117a2521fcc3304541c937385febd66b Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 2 May 2016 03:20:22 +0000 Subject: view: disable subject threading Broken threads should be exposed to hopefully encourage people to use proper mail clients which set In-Reply-To headers. --- lib/PublicInbox/SearchView.pm | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'lib/PublicInbox/SearchView.pm') diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm index 41d32007..c0cd1ffd 100644 --- a/lib/PublicInbox/SearchView.pm +++ b/lib/PublicInbox/SearchView.pm @@ -11,6 +11,7 @@ use PublicInbox::View; use PublicInbox::MID qw(mid2path mid_clean mid_mime); use Email::MIME; require PublicInbox::Git; +require PublicInbox::Thread; our $LIM = 50; sub sres_top_html { @@ -151,23 +152,19 @@ sub tdump { } ($mset->items); my @rootset; - my $th = PublicInbox::View::thread_results(\@m, 0, $q->{r}); - if ($q->{r}) { + my $th = PublicInbox::Thread->new(@m); + $th->thread; + if ($q->{r}) { # order by relevance $th->order(sub { sort { (eval { $pct{$b->topmost->messageid} } || 0) <=> (eval { $pct{$a->topmost->messageid} } || 0) } @_; }); - @rootset = $th->rootset; - } else { - @rootset = sort { - (eval { $b->topmost->message->header('X-PI-TS') } || 0) - <=> - (eval { $a->topmost->message->header('X-PI-TS') } || 0) - } $th->rootset; + } else { # order by time (default for threaded view) + $th->order(*PublicInbox::View::sort_ts); } - + @rootset = $th->rootset; my $git = $ctx->{git} ||= PublicInbox::Git->new($ctx->{git_dir}); my $state = { ctx => $ctx, -- cgit v1.2.3-24-ge0c7