]> Sergey Matveev's repositories - public-inbox.git/commitdiff
view: standalone view shows link to index
authorEric Wong <e@80x24.org>
Mon, 15 Sep 2014 03:00:49 +0000 (03:00 +0000)
committerEric Wong <e@80x24.org>
Mon, 15 Sep 2014 03:00:49 +0000 (03:00 +0000)
Sometimes people come from sharing links and not the index,
so the back button in their browser does not really go back.

lib/PublicInbox/View.pm

index 92c202387446d7ca6630688817905e99c26a6a82..d3849dcc8978cd03b09f17cde3e4682ad2125e0b 100644 (file)
@@ -301,7 +301,7 @@ sub headers_to_html_header {
 }
 
 sub html_footer {
-       my ($mime, $purge) = @_;
+       my ($mime, $standalone) = @_;
        my %cc; # everyone else
        my $to; # this is the From address
 
@@ -316,7 +316,7 @@ sub html_footer {
                        $to ||= $dst;
                }
        }
-       Email::Address->purge_cache if $purge;
+       Email::Address->purge_cache if $standalone;
 
        my $subj = $mime->header('Subject') || '';
        $subj = "Re: $subj" unless $subj =~ /\bRe:/;
@@ -329,7 +329,9 @@ sub html_footer {
        my $cc = uri_escape_utf8(join(',', values %cc));
        my $href = "mailto:$to?In-Reply-To=$irp&Cc=${cc}&Subject=$subj";
 
-       "<a\nhref=\"" . ascii_html($href) . '">reply</a>';
+       my $idx = $standalone ? " <a\nhref=\"../\">index</a>" : '';
+
+       "<a\nhref=\"" . ascii_html($href) . '">reply</a>' . $idx;
 }
 
 sub linkify_refs {