diff options
author | Eric Wong (Contractor, The Linux Foundation) <e@80x24.org> | 2018-03-26 19:33:18 +0000 |
---|---|---|
committer | Eric Wong (Contractor, The Linux Foundation) <e@80x24.org> | 2018-03-27 10:18:45 +0000 |
commit | 956abe9ad5f13a0d1755262be412d6a54fda72e9 (patch) | |
tree | cda2a73b8e234dbf6e3b1842e541054ab8a4d777 /t/psgi_v2.t | |
parent | 50f7b8e95db516104cef237bb0a555a566ff150e (diff) | |
download | public-inbox-956abe9ad5f13a0d1755262be412d6a54fda72e9.tar.gz |
Since we need to handle messages with multiple and duplicate Message-ID headers, our thread skeleton display must account for that. Since we have a "preferred" Message-ID in case of conflicts, use it as the UUID in an Atom feed so readers do not get confused by conflicts.
Diffstat (limited to 't/psgi_v2.t')
-rw-r--r-- | t/psgi_v2.t | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/t/psgi_v2.t b/t/psgi_v2.t index eaa3218c..2a798d6f 100644 --- a/t/psgi_v2.t +++ b/t/psgi_v2.t @@ -139,6 +139,32 @@ test_psgi(sub { $www->call(@_) }, sub { foreach my $mid ('a-mid@b', $new_mid, $third) { like($raw, qr/<\Q$mid\E>/s, "Message-ID $mid shown"); } + like($raw, qr/\b3\+ messages\b/, 'thread overview shown'); + + my $exp = [ qw(<a-mid@b> <reuse@mid>) ]; + $mime->header_set('Message-Id', @$exp); + $mime->header_set('Subject', '4th dupe'); + local $SIG{__WARN__} = sub {}; + ok($im->add($mime), 'added one message'); + $im->done; + my @h = $mime->header('Message-ID'); + is_deeply($exp, \@h, 'reused existing Message-ID'); + + $config->each_inbox(sub { $_[0]->search->reopen }); + + $res = $cb->(GET('/v2test/new.atom')); + my @ids = ($res->content =~ m!<id>urn:uuid:([^<]+)</id>!sg); + my %ids; + $ids{$_}++ for @ids; + is_deeply([qw(1 1 1 1)], [values %ids], 'feed ids unique'); + + $res = $cb->(GET('/v2test/reuse@mid/T/')); + $raw = $res->content; + like($raw, qr/\b4\+ messages\b/, 'thread overview shown with /T/'); + + $res = $cb->(GET('/v2test/reuse@mid/t/')); + $raw = $res->content; + like($raw, qr/\b4\+ messages\b/, 'thread overview shown with /t/'); }); done_testing(); |