diff options
author | Eric Wong <e@80x24.org> | 2016-12-20 23:42:36 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-12-21 07:32:56 +0000 |
commit | 90b3d23352a0c37680ac266acaf4fef73a781bc9 (patch) | |
tree | 93d0a1a539f923a7045c517a882bd42995fd7567 /lib/PublicInbox/View.pm | |
parent | 93474f58d361b2ace4d5e51d5be4c220513da8d0 (diff) | |
download | public-inbox-90b3d23352a0c37680ac266acaf4fef73a781bc9.tar.gz |
This simplifies callers to prevent errors and avoids needless object-orientation in favor of a single procedure call to handle threading and ordering.
Diffstat (limited to 'lib/PublicInbox/View.pm')
-rw-r--r-- | lib/PublicInbox/View.pm | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index a50cb642..b7796651 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -260,8 +260,8 @@ sub _th_index_lite { } sub walk_thread { - my ($th, $ctx, $cb) = @_; - my @q = map { (0, $_, -1) } @{$th->{rootset}}; + my ($rootset, $ctx, $cb) = @_; + my @q = map { (0, $_, -1) } @$rootset; while (@q) { my ($level, $node, $i) = splice(@q, 0, 3); defined $node or next; @@ -285,10 +285,10 @@ sub thread_index_entry { } sub stream_thread ($$) { - my ($th, $ctx) = @_; + my ($rootset, $ctx) = @_; my $inbox = $ctx->{-inbox}; my $mime; - my @q = map { (0, $_) } @{$th->{rootset}}; + my @q = map { (0, $_) } @$rootset; my $level; while (@q) { $level = shift @q; @@ -350,10 +350,10 @@ sub thread_html { $ctx->{mapping} = {}; $ctx->{s_nr} = "$nr+ messages in thread"; - my $th = thread_results($msgs); - walk_thread($th, $ctx, *pre_thread); + my $rootset = thread_results($msgs); + walk_thread($rootset, $ctx, *pre_thread); $skel .= '</pre>'; - return stream_thread($th, $ctx) unless $ctx->{flat}; + return stream_thread($rootset, $ctx) unless $ctx->{flat}; # flat display: lazy load the full message from smsg my $inbox = $ctx->{-inbox}; @@ -749,10 +749,7 @@ sub msg_timestamp { sub thread_results { my ($msgs) = @_; require PublicInbox::SearchThread; - my $th = PublicInbox::SearchThread->new($msgs); - $th->thread; - $th->order(*sort_ts); - $th + PublicInbox::SearchThread::thread($msgs, *sort_ts); } sub missing_thread { |