lib/PublicInbox/Search.pm | 4 ++--
lib/PublicInbox/View.pm | 28 +++++++++++++++++-----------
t/search.t | 6 +++---
diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm
index f4f00b252ced067b4a7df8c5617638fa47b6855d..6fd46f442d66d1f8a000f969f6b3077541bfb7ee 100644
--- a/lib/PublicInbox/Search.pm
+++ b/lib/PublicInbox/Search.pm
@@ -218,8 +218,8 @@ my $query = $self->qp->parse_query("path:$path", 0);
$self->do_enquire($query);
}
-# given a message ID, get replies to a message
-sub get_replies {
+# given a message ID, get followups to a message
+sub get_followups {
my ($self, $mid, $opts) = @_;
$mid = mid_clean($mid);
$mid = mid_compressed($mid);
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 496093510659c19eb52c35484700013d38a3691b..4f2833b3f4531aa7ad650bcff03d64da3d1ef069 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -133,7 +133,8 @@ $rv .= " parent";
}
if ($srch) {
- $rv .= " thread";
+ $rv .= " " .
+ "threadlink";
}
$rv . "\n\n";
@@ -154,7 +155,14 @@ $th->order(*PublicInbox::Thread::sort_ts);
my $state = [ $srch, { root_anchor => anchor_for($mid) }, undef, 0 ];
thread_entry(\$rv, $state, $_, 0) for $th->rootset;
my $final_anchor = $state->[3];
- my $next = "end of thread\n";
+ my $next = "";
+
+ if ($final_anchor == 1) {
+ $next .= 'only message in thread';
+ } else {
+ $next .= 'end of thread';
+ }
+ $next .= ", back to index\n";
$rv .= "
" . PRE_WRAP . $next . $foot . "";
}
@@ -432,14 +440,15 @@ if ($idx && $srch) {
$irt = $mime->header_obj->header_raw('In-Reply-To') || '';
$mid = mid_compressed(mid_clean($mid));
my $t_anchor = length $irt ? T_ANCHOR : '';
- $idx = " thread$idx";
- my $res = $srch->get_replies($mid);
+ $idx = " ".
+ "threadlink$idx";
+ my $res = $srch->get_followups($mid);
if (my $c = $res->{count}) {
- $c = $c == 1 ? '1 reply' : "$c replies";
+ $c = $c == 1 ? '1 followup' : "$c followups";
$idx .= "\n$c:\n";
- thread_replies(\$idx, $mime, $res);
+ thread_followups(\$idx, $mime, $res);
} else {
- $idx .= "\n(no replies yet)\n";
+ $idx .= "\n(no followups, yet)\n";
}
if ($irt) {
$irt = PublicInbox::Hval->new_msgid($irt);
@@ -512,12 +521,9 @@ $subj =~ s/\s+/ /;
Digest::SHA::sha1($subj);
}
-sub thread_replies {
+sub thread_followups {
my ($dst, $root, $res) = @_;
my @msgs = map { $_->mini_mime } @{$res->{msgs}};
- foreach (@{$res->{msgs}}) {
- print STDERR "smsg->path: <", $_->path, ">\n";
- }
require PublicInbox::Thread;
$root->header_set('X-PI-TS', '0');
my $th = PublicInbox::Thread->new($root, @msgs);
diff --git a/t/search.t b/t/search.t
index 7ef86cd4ac1d5fe6485c291d0f5038beeb53585c..2bb6b6cf02eaaa3017b07b86e0d12200d0d2a135 100644
--- a/t/search.t
+++ b/t/search.t
@@ -175,9 +175,9 @@ my @res = filter_mids($res);
is_deeply(\@res, [ sort('last@s', $long_midc) ],
"got expected results for references: match");
- my $replies = $ro->get_replies('root@s');
- $replies = [ filter_mids($replies) ];
- is_deeply($replies, [ filter_mids($res) ], "get_replies matches");
+ my $followups = $ro->get_followups('root@s');
+ $followups = [ filter_mids($followups) ];
+ is_deeply($followups, [ filter_mids($res) ], "get_followups matches");
my $long_reply_mid = 'reply-to-long@1';
my $long_reply = Email::MIME->create(