diff options
author | Eric Wong <e@yhbt.net> | 2020-07-05 23:27:54 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-07-06 20:01:15 +0000 |
commit | ba212558b86874d197c86e2acd0776b5b095ee5b (patch) | |
tree | 9d82f350fd372c3906f51dca0c69c792b7ebbdf7 /lib/PublicInbox | |
parent | 5afb24f06627641e3fed608e807b5ab628cda348 (diff) | |
download | public-inbox-ba212558b86874d197c86e2acd0776b5b095ee5b.tar.gz |
This simplifies the primary callers of eml_entry while only making mknews.perl worse.
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r-- | lib/PublicInbox/Feed.pm | 3 | ||||
-rw-r--r-- | lib/PublicInbox/SearchView.pm | 3 | ||||
-rw-r--r-- | lib/PublicInbox/View.pm | 9 |
3 files changed, 7 insertions, 8 deletions
diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index 476d946f..bf095a2c 100644 --- a/lib/PublicInbox/Feed.pm +++ b/lib/PublicInbox/Feed.pm @@ -51,8 +51,7 @@ sub new_html_i { my ($ctx, $eml) = @_; $ctx->zmore($ctx->html_top) if exists $ctx->{-html_tip}; - $eml and return PublicInbox::View::eml_entry($ctx, $eml, - scalar @{$ctx->{msgs}}); + $eml and return PublicInbox::View::eml_entry($ctx, $eml); my $smsg = shift @{$ctx->{msgs}} or $ctx->zmore(PublicInbox::View::pagination_footer( $ctx, './new.html')); diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm index 623b16fb..84c04c6c 100644 --- a/lib/PublicInbox/SearchView.pm +++ b/lib/PublicInbox/SearchView.pm @@ -294,8 +294,7 @@ sub mset_thread { sub mset_thread_i { my ($ctx, $eml) = @_; $ctx->zmore($ctx->html_top) if exists $ctx->{-html_tip}; - $eml and return PublicInbox::View::eml_entry($ctx, $eml, - scalar @{$ctx->{msgs}}); + $eml and return PublicInbox::View::eml_entry($ctx, $eml); my $smsg = shift @{$ctx->{msgs}} or $ctx->zmore(${delete($ctx->{skel})}); $smsg; diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 60dad6ba..d7ec4eb0 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -176,7 +176,7 @@ sub fmt_ts ($) { strftime('%Y-%m-%d %k:%M', gmtime($_[0])) } # Displays the text of of the message for /$INBOX/$MSGID/[Tt]/ endpoint # this is already inside a <pre> sub eml_entry { - my ($ctx, $eml, $more) = @_; + my ($ctx, $eml) = @_; my $smsg = delete $ctx->{smsg}; my $subj = delete $smsg->{subject}; my $mid_raw = $smsg->{mid}; @@ -267,7 +267,8 @@ sub eml_entry { $hr = $ctx->{-hr}; } - $rv .= $more ? '</pre><hr><pre>' : '</pre>' if $hr; + # do we have more messages? start a new <pre> if so + $rv .= scalar(@{$ctx->{msgs}}) ? '</pre><hr><pre>' : '</pre>' if $hr; $rv; } @@ -368,7 +369,7 @@ sub pre_thread { # walk_thread callback sub thread_eml_entry { my ($ctx, $eml) = @_; my ($beg, $end) = thread_adj_level($ctx, $ctx->{level}); - $beg . '<pre>' . eml_entry($ctx, $eml, 0) . '</pre>' . $end; + $beg . '<pre>' . eml_entry($ctx, $eml) . '</pre>' . $end; } sub next_in_queue ($$) { @@ -463,7 +464,7 @@ sub thread_html_i { # PublicInbox::WwwStream::getline callback $ctx->{-title_html} = ascii_html($smsg->{subject}); $ctx->zmore($ctx->html_top); } - return eml_entry($ctx, $eml, scalar @{$ctx->{msgs}}); + return eml_entry($ctx, $eml); } else { while (my $smsg = shift @{$ctx->{msgs}}) { return $smsg if exists($smsg->{blob}); |