Commit 13cfb0cf authored by Arkadiusz Hiler's avatar Arkadiusz Hiler
Browse files

parsemail: Use new cover letter if provided

Due to complex handling of incoming series all the new cover letters
were not used.

parsemail creates new, transient revision that is later discarded.
Everything that should get persistent in the proper revision has to be
copied over explicitly in on_revision_complete signal handler.

So let's do that for all the cover_letter fields, but only if they are
Signed-off-by: default avatarArkadiusz Hiler <>
parent 67a63377
Pipeline #16528 passed with stage
in 2 minutes and 42 seconds
......@@ -727,6 +727,14 @@ def on_revision_complete(sender, revision, **kwargs):
new_revision = previous_series.latest_revision().duplicate_meta()
new_revision.root_msgid = revision.root_msgid
new_revision.n_patches = revision.n_patches
if revision.cover_letter:
new_revision.cover_letter = revision.cover_letter
if revision.raw_cover_letter:
new_revision.raw_cover_letter = revision.raw_cover_letter
if revision.raw_cover_letter_headers:
new_revision.raw_cover_letter_headers = \
i = 1
for patch in revision.ordered_patches():
......@@ -924,3 +924,33 @@ class StateChangeEventLogTest(Series0010):
update_count += 1
stateChangeLogCount = EventLog.objects.filter(event_id=2).count()
self.assertEquals(update_count, stateChangeLogCount)
class CoverLetterUpdates(IntelGfxTest):
raw_cover_letter = "This is new cover letter\n-- \n2.2"
cover_letter = "This is new cover letter"
def testNewCoverLetterShouldBeStored(self):
test_series = TestSeries(3, project=self.project,
test_series_updated = TestSeries(3, project=self.project,
updated_mails = test_series_updated.create_mails()
revisions = list(SeriesRevision.objects.all())
self.assertEquals(len(revisions), 2)
original = revisions[0]
updated = revisions[1]
self.assertNotEqual(original.cover_letter, updated.cover_letter)
self.assertEqual(updated.cover_letter, self.cover_letter)
self.assertEqual(updated.raw_cover_letter, self.raw_cover_letter)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment