diff options
author | Eric Wong <e@yhbt.net> | 2020-07-05 23:27:51 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-07-06 20:01:15 +0000 |
commit | 208450d2347ab92de7dcb9733fb51543df32635a (patch) | |
tree | 48ebf4b89d1c62d698460aacd32006d89c77087b /lib/PublicInbox/View.pm | |
parent | bf8ea90e0db55666e558893bf00b703ddd211d45 (diff) | |
download | public-inbox-208450d2347ab92de7dcb9733fb51543df32635a.tar.gz |
We can build and buffer the HTML <head> section once the first non-ghost message in a thread is loaded, so there's no need to perform an extra check on $ctx->{nr} once the $eml is ready.
Diffstat (limited to 'lib/PublicInbox/View.pm')
-rw-r--r-- | lib/PublicInbox/View.pm | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 65695392..138e0c3a 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -389,15 +389,7 @@ sub next_in_queue ($$) { sub stream_thread_i { # PublicInbox::WwwStream::getline callback my ($ctx, $eml) = @_; - - if ($eml) { - if ($ctx->{nr} == 1) { - $ctx->{-title_html} = - ascii_html($ctx->{smsg}->{subject}); - $ctx->zmore($ctx->html_top); - } - goto &thread_eml_entry; # tail recursion - } + goto &thread_eml_entry if $eml; # tail recursion return unless exists($ctx->{skel}); my $ghost_ok = $ctx->{nr}++; while (1) { @@ -405,6 +397,11 @@ sub stream_thread_i { # PublicInbox::WwwStream::getline callback if ($smsg) { if (exists $smsg->{blob}) { # next message for cat-file $ctx->{level} = $lvl; + if (!$ghost_ok) { # first non-ghost + $ctx->{-title_html} = + ascii_html($smsg->{subject}); + $ctx->zmore($ctx->html_top); + } return $smsg; } # buffer the ghost entry and loop |