From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.9 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, RP_MATCHES_RCVD shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: meta@public-inbox.org Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id C69C96338D7 for ; Fri, 4 Sep 2015 08:59:03 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 5/9] view: reduce redundant attributions in permalink refs Date: Fri, 4 Sep 2015 08:58:55 +0000 Message-Id: <1441357139-23879-6-git-send-email-e@80x24.org> In-Reply-To: <1441357139-23879-1-git-send-email-e@80x24.org> References: <1441357139-23879-1-git-send-email-e@80x24.org> List-Id: No point in repeating authorship when PATCH messages are threaded and it's obvious from the top message who the author is of the series: [this message] - John Smith @ 2015-09-04 00:04:20 UTC ` [PATCH 1/4] view: eliminate redundant [threaded|flat] link ` [PATCH 2/4] view: one line for thread subjects ` [PATCH 3/4] view: adjust spacing and indentation of index threads ` [PATCH 4/4] view: add missing newline to inline dump --- lib/PublicInbox/View.pm | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 6b71703..d025c99 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -465,6 +465,8 @@ sub thread_inline { cur => $mid, parent_cmp => defined $parent ? $parent : '', parent => $parent, + prev_attr => '', + prev_level => 0, }; for (thread_results(load_results($res))->rootset) { inline_dump($dst, $state, $upfx, $_, 0); @@ -691,15 +693,24 @@ sub _inline_header { my $mid = mid_clean($mime->header('Message-ID')); my $f = $mime->header('X-PI-From'); my $d = _msg_date($mime); - $f = PublicInbox::Hval->new($f); - $d = PublicInbox::Hval->new($d); - $f = $f->as_html; - $d = $d->as_html . ' UTC'; + $f = PublicInbox::Hval->new($f)->as_html; + $d = PublicInbox::Hval->new($d)->as_html; + my $attr = "$f @ $d"; + $state->{first_level} ||= $level; + if ($attr ne $state->{prev_attr} || $state->{prev_level} > $level) { + $state->{prev_attr} = $attr; + $attr = ' - ' . $attr; + $attr .= ' UTC' if $level >= $state->{first_level}; + } else { + $attr = ''; + } + $state->{prev_level} = $level; + if ($cur) { if ($cur eq $mid) { delete $state->{cur}; $$dst .= "$pfx` ". - "[this message] by $f @ $d\n"; + "[this message]$attr\n"; return; } @@ -722,7 +733,7 @@ sub _inline_header { my $m = PublicInbox::Hval->new_msgid($mid); $m = $upfx . '../' . $m->as_href . '/'; if (defined $s) { - $$dst .= "$pfx` $s by $f @ $d\n"; + $$dst .= "$pfx` $s$attr\n"; } else { $$dst .= "$pfx` $f @ $d\n"; } -- EW