user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 2/2] www: omit [thread overview] link for unindexed v1
  2022-09-02  9:10  6% [PATCH 0/2] www: unindexed v1 fixes Eric Wong
@ 2022-09-02  9:10  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2022-09-02  9:10 UTC (permalink / raw)
  To: meta

Unindexed v1 inboxes do not have the thread overview skeleton
at the bottom of /$MSGID/ pages, so do not link to it.
And for rare messages without a Date: header (or any headers!),
this also ensures the [thread overview] is shown regardless.
---
 lib/PublicInbox/View.pm | 8 +++++++-
 t/plack.t               | 2 ++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 11a94ba9..2b8e220b 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -717,7 +717,13 @@ sub _msg_page_prepare_obuf {
 	for my $v ($eml->header('Date')) {
 		$v = ascii_html($v);
 		obfuscate_addrs($obfs_ibx, $v) if $obfs_ibx; # possible :P
-		$rv .= qq{Date: $v\t<a\nhref="#r">[thread overview]</a>\n};
+		$rv .= qq{Date: $v\n};
+	}
+	# [thread overview] link is typically added after Date,
+	# but added after Subject, or even nothing.
+	if ($have_over) {
+		chop $rv; # drop "\n", or noop if $rv eq ''
+		$rv .= qq{\t<a\nhref="#r">[thread overview]</a>\n};
 	}
 	if (!$nr) { # first (and only) message, common case
 		$ctx->{-title_html} = join(' - ', @title);
diff --git a/t/plack.t b/t/plack.t
index 3ba2e6fb..1cee286d 100644
--- a/t/plack.t
+++ b/t/plack.t
@@ -158,6 +158,8 @@ my $c1 = sub {
 	like($html, qr!<title>hihi - Me</title>!, 'HTML returned');
 	like($html, qr!<a\nhref=raw!s, 'raw link present');
 	like($html, qr!&gt; quoted text!s, 'quoted text inline');
+	unlike($html, qr!thread overview!,
+		'thread overview not shown w/o ->over');
 
 	$path .= 'f/';
 	$res = $cb->(GET($pfx . $path));

^ permalink raw reply related	[relevance 7%]

* [PATCH 0/2] www: unindexed v1 fixes
@ 2022-09-02  9:10  6% Eric Wong
  2022-09-02  9:10  7% ` [PATCH 2/2] www: omit [thread overview] link for unindexed v1 Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2022-09-02  9:10 UTC (permalink / raw)
  To: meta

While it's rare to find someone running unindexed v1 inboxes
nowadays, we can't drop support for them, either.  So do our
best to ensure they still work.

Eric Wong (2):
  www: fix top nav bar for unindexed v1 inboxes
  www: omit [thread overview] link for unindexed v1

 lib/PublicInbox/View.pm | 10 ++++++++--
 t/plack.t               |  5 ++++-
 2 files changed, 12 insertions(+), 3 deletions(-)

^ permalink raw reply	[relevance 6%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2022-09-02  9:10  6% [PATCH 0/2] www: unindexed v1 fixes Eric Wong
2022-09-02  9:10  7% ` [PATCH 2/2] www: omit [thread overview] link for unindexed v1 Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).