diff options
author | Stephen Finucane <stephen@that.guru> | 2019-12-01 17:10:44 +0000 |
---|---|---|
committer | Stephen Finucane <stephen@that.guru> | 2019-12-27 13:21:11 +0000 |
commit | d9612cf485ad111fc73e093725142550473c2bb2 (patch) | |
tree | b49078bdb22f7a3d02e566c9632296f75e258fbe /patchwork/tests | |
parent | 9f72eb793dfb6e9d7ff54465d4b07291e9a75e38 (diff) | |
download | patchwork-d9612cf485ad111fc73e093725142550473c2bb2.tar patchwork-d9612cf485ad111fc73e093725142550473c2bb2.tar.gz |
parser: Use a second query to weed out duplicate series
Annoyingly, not all email clients properly thread emails using the
message ID fields originally specified in RFC 822 [1]. Worse, some MTAs
(cough, outlook.com, cough) actually override what the client
configures, breaking the world in the process. Realising this is an
issue, Patchwork supports threading using arbitrary metadata in addition
to the RFC 822 metadata. Specifically, it uses a combination of
submitter and list-id extracted from the headers along with the series
version and total count metadata extracted from the subject. In addition
to this, we timebox things so that two or more series that match on all
of this metadata but which are sent some time apart from each other
aren't combined by accident. This does leave one edge case - duplicate
series received within the timebox will be combined. We've resigned
ourselves to this fact on the basis that it's extremely unlikely for all
of these things to go wrong at once.
Given all the above, there should be no reason that attempting to find
series by series markers should return more than one series. The
timeboxing will prevent us grouping similar looking series by accident
and the only other reason for this to happen is because we lost a race
and we should try again.
[1] https://tools.ietf.org/html/rfc822
Signed-off-by: Stephen Finucane <stephen@that.guru>
Cc: Daniel Axtens <dja@axtens.net>
Diffstat (limited to 'patchwork/tests')
-rw-r--r-- | patchwork/tests/test_parser.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/patchwork/tests/test_parser.py b/patchwork/tests/test_parser.py index 0edbd87..4a85fd4 100644 --- a/patchwork/tests/test_parser.py +++ b/patchwork/tests/test_parser.py @@ -400,8 +400,8 @@ class SeriesCorrelationTest(TestCase): email = self._create_email(msgid) project = create_project() - self.assertIsNone(find_series(project, email, - get_or_create_author(email))) + self.assertFalse(find_series(project, email, + get_or_create_author(email))) def test_first_reply(self): msgid_a = make_msgid() @@ -413,7 +413,7 @@ class SeriesCorrelationTest(TestCase): series = find_series(ref.series.project, email, get_or_create_author(email)) - self.assertEqual(series, ref.series) + self.assertEqual(series.first(), ref.series) def test_nested_series(self): """Handle a series sent in-reply-to an existing series.""" @@ -443,7 +443,7 @@ class SeriesCorrelationTest(TestCase): # this should link to the second series - not the first self.assertEqual(len(msgids), 4 + 1) # old series + new cover - self.assertEqual(series, ref_v2.series) + self.assertEqual(series.first(), ref_v2.series) class SubjectEncodingTest(TestCase): |