]> Sergey Matveev's repositories - public-inbox.git/commitdiff
view: do not fold top-level messages in thread
authorEric Wong <e@80x24.org>
Thu, 20 Aug 2015 02:51:28 +0000 (02:51 +0000)
committerEric Wong <e@80x24.org>
Thu, 20 Aug 2015 02:51:28 +0000 (02:51 +0000)
This hopefully reduces clicking.  We may drop folding entirely
since we can use Xapian to make searching easier.

lib/PublicInbox/View.pm

index 391e3ad79b0dad9c01ce5df4f738b2e5ede34719..17af21f741b3bb07d057f1d6fec32369a1cdae72 100644 (file)
@@ -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;