From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 5/9] terminology: replies => followups
Date: Mon, 17 Aug 2015 03:38:13 +0000 [thread overview]
Message-ID: <1439782697-16412-6-git-send-email-e@80x24.org> (raw)
In-Reply-To: <1439782697-16412-1-git-send-email-e@80x24.org>
Replies are only direct replies, but followups could be any message
further down the thread. The latter is more useful.
---
lib/PublicInbox/Search.pm | 4 ++--
lib/PublicInbox/View.pm | 28 +++++++++++++++++-----------
t/search.t | 6 +++---
3 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm
index f4f00b2..6fd46f4 100644
--- a/lib/PublicInbox/Search.pm
+++ b/lib/PublicInbox/Search.pm
@@ -218,8 +218,8 @@ sub get_subject_path {
$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 4960935..4f2833b 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -133,7 +133,8 @@ sub index_entry {
}
if ($srch) {
- $rv .= " <a\nhref=\"${path}t/$href.html$t_anchor\">thread</a>";
+ $rv .= " <a\nhref=\"${path}t/$href.html$t_anchor\">" .
+ "threadlink</a>";
}
$rv . "\n\n";
@@ -154,7 +155,14 @@ sub thread_html {
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 = "<a\nid=\"s$final_anchor\">end of thread</a>\n";
+ my $next = "<a\nid=\"s$final_anchor\">";
+
+ if ($final_anchor == 1) {
+ $next .= 'only message in thread';
+ } else {
+ $next .= 'end of thread';
+ }
+ $next .= ", back to <a\nhref=\"../\">index</a>\n";
$rv .= "</pre><hr />" . PRE_WRAP . $next . $foot . "</pre>";
}
@@ -432,14 +440,15 @@ sub html_footer {
$irt = $mime->header_obj->header_raw('In-Reply-To') || '';
$mid = mid_compressed(mid_clean($mid));
my $t_anchor = length $irt ? T_ANCHOR : '';
- $idx = " <a\nhref=\"../t/$mid.html$t_anchor\">thread</a>$idx";
- my $res = $srch->get_replies($mid);
+ $idx = " <a\nhref=\"../t/$mid.html$t_anchor\">".
+ "threadlink</a>$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 @@ sub hash_subj {
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 7ef86cd..2bb6b6c 100644
--- a/t/search.t
+++ b/t/search.t
@@ -175,9 +175,9 @@ sub filter_mids {
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(
--
EW
next prev parent reply other threads:[~2015-08-17 3:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-17 3:38 [PATCH 0/9] search pushed and deployed to master Eric Wong
2015-08-17 3:38 ` [PATCH 1/9] feed: remove unnecesary time paramenter in index state Eric Wong
2015-08-17 3:38 ` [PATCH 2/9] favor /t/ to /s/, since subjects may change mid-thread Eric Wong
2015-08-17 3:38 ` [PATCH 3/9] WWW: eliminate "top" parameter for feeds Eric Wong
2015-08-17 3:38 ` [PATCH 4/9] www: simplify parameter passing to feed Eric Wong
2015-08-17 3:38 ` Eric Wong [this message]
2015-08-17 3:38 ` [PATCH 6/9] search: use raw headers without MIME decoding Eric Wong
2015-08-17 3:38 ` [PATCH 7/9] feed: disable the generator statement Eric Wong
2015-08-17 3:38 ` [PATCH 8/9] drop bodies and messages ASAP after processing Eric Wong
2015-08-17 3:38 ` [PATCH 9/9] search: apply mid_compression to subject paths, too Eric Wong
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
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1439782697-16412-6-git-send-email-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.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.
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).