about summary refs log tree commit homepage
path: root/lib/PublicInbox/WwwStream.pm
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-08-27 22:04:59 +0000
committerEric Wong <e@yhbt.net>2020-08-28 04:25:15 +0000
commit6c853f5256f3a324c018a37a9e8a6b9fc8fdc063 (patch)
treee8cbeb6cecde0e25ea4bc16d6ea53f19a42671c7 /lib/PublicInbox/WwwStream.pm
parent29c5f2a6fc3b86306a5dbeadfae061d06f2bc6dd (diff)
downloadpublic-inbox-6c853f5256f3a324c018a37a9e8a6b9fc8fdc063.tar.gz
Sometimes it's useful to quickly get to threads and messages
which are contemporaries of the current thread/message being
focused on.  This hopefully improves navigation by making:

a) the top line (where $INBOX_DIR/description) is shown
   a link to the latest topics in search results and
   per-thread/per-message views.

b) providing a link to contemporaries ("~YYYY-MM-DD") at
   around the thread overview skeleton area for per-thread
   and per-message views
Diffstat (limited to 'lib/PublicInbox/WwwStream.pm')
-rw-r--r--lib/PublicInbox/WwwStream.pm9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm
index d79770ed..e06e3456 100644
--- a/lib/PublicInbox/WwwStream.pm
+++ b/lib/PublicInbox/WwwStream.pm
@@ -10,7 +10,7 @@ use strict;
 use parent qw(Exporter PublicInbox::GzipFilter);
 our @EXPORT_OK = qw(html_oneshot);
 use bytes (); # length
-use PublicInbox::Hval qw(ascii_html prurl);
+use PublicInbox::Hval qw(ascii_html prurl ts2str);
 our $TOR_URL = 'https://www.torproject.org/';
 our $CODE_URL = 'https://public-inbox.org/public-inbox.git';
 
@@ -43,6 +43,13 @@ sub html_top ($) {
         my $color = $upfx.'_/text/color';
         my $atom = $ctx->{-atom} || $upfx.'new.atom';
         my $top = "<b>$desc</b>";
+        if (my $t_max = $ctx->{-t_max}) {
+                $t_max = ts2str($t_max);
+                $top = qq(<a\nhref="$upfx?t=$t_max">$top</a>);
+        # we had some kind of query, link to /$INBOX/?t=YYYYMMDDhhmmss
+        } elsif ($ctx->{qp}->{t}) {
+                $top = qq(<a\nhref="./">$top</a>);
+        }
         my $links = "<a\nhref=\"$help\">help</a> / ".
                         "<a\nhref=\"$color\">color</a> / ".
                         "<a\nhref=\"$atom\">Atom feed</a>";