lib/PublicInbox/Feed.pm | 12 ++++++++---- lib/PublicInbox/View.pm | 37 ++++++++++++++++++++----------------- lib/PublicInbox/WWW.pm | 8 ++++---- t/view.t | 10 +++++----- diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index f4d19e0208d1355101e8e03cd521b99b6c568b8f..969fc1107652ad8b74a966eee17d9d770e580844 100644 --- a/lib/PublicInbox/Feed.pm +++ b/lib/PublicInbox/Feed.pm @@ -89,7 +89,12 @@ my $srch = $ctx->{srch}; $srch and $topics = [ [], {} ]; my (undef, $last) = each_recent_blob($ctx, sub { my ($path, $commit, $ts, $u, $subj) = @_; - $state ||= [ undef, {}, $commit, 0 ]; + $state ||= { + ctx => $ctx, + seen => {}, + first_commit => $commit, + anchor_idx => 0, + }; if ($srch) { add_topic($git, $srch, $topics, $path, $ts, $u, $subj); @@ -119,9 +124,8 @@ $cgi or return ''; my $old_r = $cgi->param('r'); my $head = ' '; my $next = ' '; - # $state = [ undef, {}, $first_commit, $last_anchor ]; - my $first = $state->[2]; - my $anchor = $state->[3]; + my $first = $state->{first_commit}; + my $anchor = $state->{anchor_idx}; if ($last) { $next = qq!next!; diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index cf5826886544ffa7879196db324944b7a3121680..64a2086d349e843b644bf94c1797173f69153966 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -25,16 +25,17 @@ my $enc_utf8 = find_encoding('UTF-8'); # public functions: sub msg_html { - my ($class, $mime, $full_pfx, $footer, $srch) = @_; + my ($ctx, $mime, $full_pfx, $footer) = @_; if (defined $footer) { $footer = "\n" . $footer; } else { $footer = ''; } + my $srch = $ctx->{srch} if $ctx; headers_to_html_header($mime, $full_pfx, $srch) . multipart_text_as_html($mime, $full_pfx) . '
' . - html_footer($mime, 1, $full_pfx, $srch) . + html_footer($mime, 1, $full_pfx, $ctx) . $footer . '