]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/View.pm
cleanup: use '$ibx' consistently when referring to Inbox refs
[public-inbox.git] / lib / PublicInbox / View.pm
index 69aca3d79418e65b56161d2374ae2051bd613715..f94daaf2bd65521a97ab591eacb102fc71056ddd 100644 (file)
@@ -6,6 +6,7 @@
 package PublicInbox::View;
 use strict;
 use warnings;
+use bytes (); # only for bytes::length
 use PublicInbox::MsgTime qw(msg_datestamp);
 use PublicInbox::Hval qw/ascii_html obfuscate_addrs/;
 use PublicInbox::Linkify;
@@ -398,7 +399,7 @@ sub thread_index_entry {
 
 sub stream_thread ($$) {
        my ($rootset, $ctx) = @_;
-       my $inbox = $ctx->{-inbox};
+       my $ibx = $ctx->{-inbox};
        my @q = map { (0, $_) } @$rootset;
        my $level;
        my $smsg;
@@ -407,11 +408,11 @@ sub stream_thread ($$) {
                my $node = shift @q or next;
                my $cl = $level + 1;
                unshift @q, map { ($cl, $_) } @{$node->{children}};
-               $smsg = $inbox->smsg_mime($node->{smsg}) and last;
+               $smsg = $ibx->smsg_mime($node->{smsg}) and last;
        }
        return missing_thread($ctx) unless $smsg;
 
-       $ctx->{-obfs_ibx} = $inbox->{obfuscate} ? $inbox : undef;
+       $ctx->{-obfs_ibx} = $ibx->{obfuscate} ? $ibx : undef;
        $ctx->{-title_html} = ascii_html($smsg->subject);
        $ctx->{-html_tip} = thread_index_entry($ctx, $level, $smsg);
        $smsg = undef;
@@ -422,7 +423,7 @@ sub stream_thread ($$) {
                        my $node = shift @q or next;
                        my $cl = $level + 1;
                        unshift @q, map { ($cl, $_) } @{$node->{children}};
-                       if ($smsg = $inbox->smsg_mime($node->{smsg})) {
+                       if ($smsg = $ibx->smsg_mime($node->{smsg})) {
                                return thread_index_entry($ctx, $level, $smsg);
                        } else {
                                return ghost_index_entry($ctx, $level, $node);
@@ -461,8 +462,8 @@ sub thread_html {
        my $rootset = thread_results($ctx, $msgs);
 
        # reduce hash lookups in pre_thread->skel_dump
-       my $inbox = $ctx->{-inbox};
-       $ctx->{-obfs_ibx} = $inbox->{obfuscate} ? $inbox : undef;
+       my $ibx = $ctx->{-inbox};
+       $ctx->{-obfs_ibx} = $ibx->{obfuscate} ? $ibx : undef;
        walk_thread($rootset, $ctx, *pre_thread);
 
        $skel .= '</pre>';
@@ -471,7 +472,7 @@ sub thread_html {
        # flat display: lazy load the full message from smsg
        my $smsg;
        while (my $m = shift @$msgs) {
-               $smsg = $inbox->smsg_mime($m) and last;
+               $smsg = $ibx->smsg_mime($m) and last;
        }
        return missing_thread($ctx) unless $smsg;
        $ctx->{-title_html} = ascii_html($smsg->subject);
@@ -481,7 +482,7 @@ sub thread_html {
                return unless $msgs;
                $smsg = undef;
                while (my $m = shift @$msgs) {
-                       $smsg = $inbox->smsg_mime($m) and last;
+                       $smsg = $ibx->smsg_mime($m) and last;
                }
                return index_entry($smsg, $ctx, scalar @$msgs) if $smsg;
                $msgs = undef;
@@ -571,6 +572,7 @@ sub add_text_body {
                $ctx->{-apfx} = join('/', @idx);
                $ctx->{-anchors} = {}; # attr => filename
                $ctx->{-diff} = $diff = [];
+               delete $ctx->{-long_path};
                my $spfx;
                if ($ibx->{-repo_objs}) {
                        if (index($upfx, '//') >= 0) { # absolute URL (Atom feeds)