about summary refs log tree commit homepage
path: root/lib/PublicInbox/View.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-09-12 01:23:32 +0000
committerEric Wong <e@80x24.org>2015-09-12 01:24:11 +0000
commit6ffa9c19e710ee2ece98a987477e9c5baaca13cd (patch)
treeedebb095b8a20c586964723f9cabddde7c8f5cf1 /lib/PublicInbox/View.pm
parent3fcca93c1391c570e71a81f9467b95d7fcd1910e (diff)
downloadpublic-inbox-6ffa9c19e710ee2ece98a987477e9c5baaca13cd.tar.gz
This hopefully makes it easy to perform queries to display
an entire thread.  Raise the limit in the threaded view to
display more results and hopefully improve the output of
thread display.
Diffstat (limited to 'lib/PublicInbox/View.pm')
-rw-r--r--lib/PublicInbox/View.pm19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 7d855550..de2d667c 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -72,7 +72,7 @@ sub index_entry {
         my $subj = $mime->header('Subject');
         my $header_obj = $mime->header_obj;
 
-        my $mid_raw = $header_obj->header('Message-ID');
+        my $mid_raw = mid_clean($header_obj->header('Message-ID'));
         my $id = anchor_for($mid_raw);
         my $seen = $state->{seen};
         $seen->{$id} = "#$id"; # save the anchor for children, later
@@ -139,7 +139,9 @@ sub index_entry {
                 }
                 $rv .= " <a\nhref=\"$parent_anchor\">parent</a>";
         }
-        if ($srch) {
+        if (my $pct = $state->{pct}) {
+                $rv .= " [$pct->{$mid_raw}%]";
+        } elsif ($srch) {
                 if ($ctx->{flat}) {
                         $rv .= " [<a\nhref=\"${path}$href/t/#u\">threaded</a>" .
                                 "|<b>flat</b>]";
@@ -601,6 +603,14 @@ sub ghost_parent {
         qq{[parent not found: &lt;<a\nhref="$upfx$href/">$html</a>&gt;]};
 }
 
+sub ghost_table {
+        my ($upfx, $mid, $level) = @_;
+        "<table\nsummary=ghost><tr><td>" .
+                (INDENT x $level) . "</td><td>" .
+                PRE_WRAP . ghost_parent($upfx, $mid) .
+                '</pre></td></table>';
+}
+
 sub __thread_entry {
         my ($cb, $git, $state, $mime, $level) = @_;
 
@@ -617,10 +627,7 @@ sub __thread_entry {
         if (my $ghost = delete $state->{ghost}) {
                 # n.b. ghost messages may only be parents, not children
                 foreach my $g (@$ghost) {
-                        $$cb->write("<table\nsummary=ghost><tr><td>" .
-                                (INDENT x $g->[1]) . "</td><td>" .
-                                PRE_WRAP . ghost_parent('../../', $g->[0]) .
-                                '</pre></td></table>');
+                        $$cb->write(ghost_table('../../', @$g));
                 }
         }
         index_entry($$cb, $mime, $level, $state);