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=-3.4 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 83AF51F8C3 for ; Thu, 20 Aug 2015 02:57:24 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 11/11] view: do not fold top-level messages in thread Date: Thu, 20 Aug 2015 02:57:23 +0000 Message-Id: <1440039443-27052-11-git-send-email-e@80x24.org> In-Reply-To: <1440039443-27052-1-git-send-email-e@80x24.org> References: <1440039443-27052-1-git-send-email-e@80x24.org> List-Id: This hopefully reduces clicking. We may drop folding entirely since we can use Xapian to make searching easier. --- lib/PublicInbox/View.pm | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 391e3ad..17af21f 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -109,11 +109,15 @@ sub index_entry { } $rv .= "\n\n"; + my ($fhref, $more_ref); my $mhref = "${path}m/$href.html"; - my $fhref = "${path}f/$href.html"; + if ($level > 0) { + $fhref = "${path}f/$href.html"; + $more_ref = \$more; + } # scan through all parts, looking for displayable text $mime->walk_parts(sub { - $rv .= index_walk($_[0], $enc_msg, $part_nr, $fhref, \$more); + $rv .= index_walk($_[0], $enc_msg, $part_nr, $fhref, $more_ref); $part_nr++; }); $mime->body_set(''); @@ -220,12 +224,14 @@ sub index_walk { my $s = add_text_body($enc, $part, $part_nr, $fhref); - # drop the remainder of git patches, they're usually better - # to review when the full message is viewed - $s =~ s!^---+\n.*\z!!ms and $$more = 'more...'; + if ($more) { + # drop the remainder of git patches, they're usually better + # to review when the full message is viewed + $s =~ s!^---+\n.*\z!!ms and $$more = 'more...'; - # Drop signatures - $s =~ s/^-- \n.*\z//ms and $$more = 'more...'; + # Drop signatures + $s =~ s/^-- \n.*\z//ms and $$more = 'more...'; + } # kill any leading or trailing whitespace lines $s =~ s/^\s*$//sgm; -- EW