X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FView.pm;h=9f87546f9428b680ad90768419700f1f62f70755;hb=aad65bb344ebca758940e1129b5604aba1e20eee;hp=4e800c685b7724fa6e76a47b55d8af280b1aa4c4;hpb=4e36325f723709757f16e28ecf82a21e750ab20d;p=public-inbox.git diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 4e800c68..9f87546f 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -1,4 +1,4 @@ -# Copyright (C) 2014, Eric Wong and all contributors +# Copyright (C) 2014-2015 all contributors # License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt) package PublicInbox::View; use strict; @@ -85,7 +85,7 @@ sub index_entry { $from = PublicInbox::Hval->new_oneline($from)->as_html; $subj = PublicInbox::Hval->new_oneline($subj)->as_html; my $more = 'permalink'; - my $root_anchor = $state->{root_anchor}; + my $root_anchor = $state->{root_anchor} || ''; my $path = $root_anchor ? '../../' : ''; my $href = $mid->as_href; my $irt = in_reply_to($header_obj); @@ -95,7 +95,7 @@ sub index_entry { my $t = $ctx->{flat} ? 'T' : 't'; $subj = "$subj"; } - if ($root_anchor && $root_anchor eq $id) { + if ($root_anchor eq $id) { $subj = "$subj"; } @@ -116,8 +116,8 @@ sub index_entry { my ($fhref, $more_ref); my $mhref = "${path}$href/"; - # show full messages at level == 0 in threaded view - if ($level > 0 || ($ctx->{flat} && $root_anchor ne $id)) { + # show full message if it's our root message + if ($root_anchor ne $id) { $fhref = "${path}$href/f/"; $more_ref = \$more; } @@ -353,7 +353,7 @@ sub add_text_body { my $ct = $part->content_type; # account for filter bugs... - if (defined $ct && $ct =~ m!\btext/[xh]+tml\b!i) { + if (defined $ct && $ct =~ m!\btext/x?html\b!i) { $part->body_set(''); return ''; } @@ -407,7 +407,6 @@ sub headers_to_html_header { my $header_obj = $mime->header_obj; my $mid = $header_obj->header('Message-ID'); $mid = PublicInbox::Hval->new_msgid($mid); - my $mid_href = $mid->as_href; foreach my $h (qw(From To Cc Subject Date)) { my $v = $mime->header($h); defined($v) && ($v ne '') or next; @@ -429,10 +428,10 @@ sub headers_to_html_header { } $rv .= 'Message-ID: <' . $mid->as_html . '> '; - my $raw_ref = $full_pfx ? 'raw' : '../raw'; - $rv .= "(raw)\n"; + my $upfx = $full_pfx ? '' : '../'; + $rv .= "(raw)\n"; if ($srch) { - $rv .= "References: [see below]\n"; + $rv .= "References: [expand]\n"; } else { $rv .= _parent_headers_nosrch($header_obj); } @@ -620,7 +619,7 @@ sub __thread_entry { foreach my $g (@$ghost) { $$cb->write("" . (INDENT x $g->[1]) . "" . - PRE_WRAP . ghost_parent('', $g->[0]) . + PRE_WRAP . ghost_parent('../', $g->[0]) . ''); } }