use PublicInbox::Hval;
use PublicInbox::GitCatFile;
use PublicInbox::View;
-use PublicInbox::MID qw/mid_clean mid_compressed/;
+use PublicInbox::MID qw/mid_clean mid_compress/;
use constant {
DATEFMT => '%Y-%m-%dT%H:%M:%SZ', # atom standard
MAX_PER_PAGE => 25, # this needs to be tunable
$srch and $topics = [ [], {} ];
my (undef, $last) = each_recent_blob($ctx, sub {
my ($path, $commit, $ts, $u, $subj) = @_;
- $state ||= [ undef, {}, $commit, 0 ];
+ $state ||= {
+ ctx => $ctx,
+ seen => {},
+ first_commit => $commit,
+ anchor_idx => 0,
+ };
if ($srch) {
add_topic($git, $srch, $topics, $path, $ts, $u, $subj);
my $old_r = $cgi->param('r');
my $head = ' ';
my $next = ' ';
- # $state = [ undef, {}, $first_commit, $last_anchor ];
- my $first = $state->[2];
- my $anchor = $state->[3];
+ my $first = $state->{first_commit};
+ my $anchor = $state->{anchor_idx};
if ($last) {
$next = qq!<a\nhref="?r=$last">next</a>!;
my $type = index($title, '&') >= 0 ? "\ntype=\"html\"" : '';
my $from = mime_header($header_obj, 'From') or return 0;
- my @from = Email::Address->parse($from);
+ my @from = Email::Address->parse($from) or return 0;
my $name = PublicInbox::Hval->new_oneline($from[0]->name)->as_html;
my $email = $from[0]->address;
$email = PublicInbox::Hval->new_oneline($email)->as_html;
$subj = mime_header($header_obj, 'Subject');
}
- $subj = $srch->subject_normalized($subj);
- if (++$subjs->{$subj} == 1) {
+ my $topic = $subj = $srch->subject_normalized($subj);
+
+ # kill "[PATCH v2]" etc. for summarization
+ $topic =~ s/\A\s*\[[^\]]+\]\s*//g;
+
+ if (++$subjs->{$topic} == 1) {
unless ($header_obj) {
my $mime = do_cat_mail($git, $path) or return 0;
$header_obj = $mime->header_obj;
}
my $mid = $header_obj->header('Message-ID');
- $mid = mid_compressed(mid_clean($mid));
+ $mid = mid_compress(mid_clean($mid));
$u = $enc_utf8->decode($u);
push @$order, [ $mid, $ts, $u, $subj ];
return 1;