From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH] view: simplify topic handling based on subjects
Date: Mon, 8 Feb 2016 18:11:43 +0000 [thread overview]
Message-ID: <20160208181143.31279-1-e@80x24.org> (raw)
Dropping "[FOO]" prefixes for the purposes of summarization
is tricky and we end up with odd display behavior.
Just show Subject line changes as the writer intended
(with the exception of normalization to strip the "Re: ")
---
lib/PublicInbox/View.pm | 22 ++++++++--------------
1 file changed, 8 insertions(+), 14 deletions(-)
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 70b92a7..fc877b7 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -867,27 +867,21 @@ sub add_topic {
if (my $x = $node->message) {
$x = $x->header_obj;
- my ($topic, $subj);
+ my $subj;
$subj = $x->header('Subject');
$subj = $state->{srch}->subject_normalized($subj);
- $topic = $subj;
- # kill "[PATCH v2]" etc. for summarization
- unless ($level == 0) {
- $topic =~ s/\A\s*\[[^\]]+\]\s*//g;
- }
-
- if (++$state->{subjs}->{$topic} == 1) {
- push @{$state->{order}}, [ $level, $subj, $topic ];
+ if (++$state->{subjs}->{$subj} == 1) {
+ push @{$state->{order}}, [ $level, $subj ];
}
my $mid = mid_clean($x->header('Message-ID'));
my $ts = $x->header('X-PI-TS');
- my $exist = $state->{latest}->{$topic};
+ my $exist = $state->{latest}->{$subj};
if (!$exist || $exist->[1] < $ts) {
- $state->{latest}->{$topic} = [ $mid, $ts ];
+ $state->{latest}->{$subj} = [ $mid, $ts ];
}
} else {
# ghost message, do not bump level
@@ -909,9 +903,9 @@ sub dump_topics {
my $prev = 0;
my $prev_attr = '';
while (defined(my $info = shift @$order)) {
- my ($level, $subj, $topic) = @$info;
- my $n = delete $subjs->{$topic};
- my ($mid, $ts) = @{delete $latest->{$topic}};
+ my ($level, $subj) = @$info;
+ my $n = delete $subjs->{$subj};
+ my ($mid, $ts) = @{delete $latest->{$subj}};
$mid = PublicInbox::Hval->new_msgid($mid)->as_href;
$subj = PublicInbox::Hval->new($subj)->as_html;
$pfx = indent_for($level);
--
EW
reply other threads:[~2016-02-08 18:11 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
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=20160208181143.31279-1-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.
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).