dumping ground for random patches and texts
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: spew@80x24.org
Subject: [PATCH] WIP thread-search HTML
Date: Thu, 30 Mar 2023 11:01:53 +0000	[thread overview]
Message-ID: <20230330110153.3744099-1-e@80x24.org> (raw)

---
 lib/PublicInbox/SearchView.pm | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm
index 07fef40c..f01edf7f 100644
--- a/lib/PublicInbox/SearchView.pm
+++ b/lib/PublicInbox/SearchView.pm
@@ -50,6 +50,12 @@ sub sres_top_html {
 		threads => $q->{t},
 		asc => $asc,
 	};
+	if (defined($ctx->{mid})) {
+		my $over = $ctx->{ibx}->over or
+			return PublicInbox::WWW::need($ctx, 'Over');
+		$opts->{threadid} = $over->mid2tid($ctx->{mid});
+		$ctx->{-upfx} = '../';
+	}
 	my ($mset, $total, $err, $html);
 retry:
 	eval {
@@ -99,6 +105,7 @@ sub mset_summary {
 	my @nums = @{$ibx->isrch->mset_to_artnums($mset)};
 	my %num2msg = map { $_->{num} => $_ } @{$ibx->over->get_all(@nums)};
 	my ($min, $max, %seen);
+	my $upfx = $ctx->{-upfx} // '';
 
 	foreach my $m ($mset->items) {
 		my $num = shift @nums;
@@ -126,7 +133,7 @@ sub mset_summary {
 		}
 		my $date = fmt_ts($smsg->{ds});
 		$s = '(no subject)' if $s eq '';
-		$$res .= qq{$rank. <b><a\nhref="$mid/">}.
+		$$res .= qq{$rank. <b><a\nhref="$upfx$mid/">}.
 			$s . "</a></b>\n";
 		$$res .= "$pfx  - by $f @ $date UTC [$pct%]\n\n";
 	}
@@ -305,7 +312,7 @@ sub mset_thread {
 	my $skel = search_nav_bot($ctx, $mset, $q).
 		"<pre>-- links below jump to the message on this page --\n";
 
-	$ctx->{-upfx} = '';
+	$ctx->{-upfx} //= '';
 	$ctx->{anchor_idx} = 1;
 	$ctx->{cur_level} = 0;
 	$ctx->{skel} = \$skel;

                 reply	other threads:[~2023-03-30 11:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230330110153.3744099-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=spew@80x24.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).