]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
Include all email headers in mboxes
authorVeronika Kabatova <vkabatov@redhat.com>
Thu, 5 Apr 2018 15:51:58 +0000 (17:51 +0200)
committerStephen Finucane <stephen@that.guru>
Sat, 7 Apr 2018 16:13:25 +0000 (17:13 +0100)
Solves issue #165 (Exported mboxes should include In-Reply-To,
References, etc headers). Instead of including only a few chosen ones,
all received headers are added to mboxes.

Signed-off-by: Veronika Kabatova <vkabatov@redhat.com>
Reviewed-by: Stephen Finucane <stephen@that.guru>
patchwork/views/utils.py

index 84682b8cc3bdcbb90cfee0762c8ad15718ef37d3..f5ff43c169ffbb119faf957e50bdbcef50d6bd77 100644 (file)
@@ -89,21 +89,17 @@ def _submission_to_mbox(submission):
     utc_timestamp = delta.seconds + delta.days * 24 * 3600
 
     mail = PatchMbox(body)
-    mail['Subject'] = submission.name
     mail['X-Patchwork-Submitter'] = email.utils.formataddr((
         str(Header(submission.submitter.name, mail.patch_charset)),
         submission.submitter.email))
     mail['X-Patchwork-Id'] = str(submission.id)
     if is_patch and submission.delegate:
         mail['X-Patchwork-Delegate'] = str(submission.delegate.email)
-    mail['Message-Id'] = submission.msgid
     mail.set_unixfrom('From patchwork ' + submission.date.ctime())
 
-    copied_headers = ['To', 'Cc', 'Date', 'From', 'List-Id']
     orig_headers = HeaderParser().parsestr(str(submission.headers))
-    for header in copied_headers:
-        if header in orig_headers:
-            mail[header] = orig_headers[header]
+    for key, val in orig_headers.items():
+        mail[key] = val
 
     if 'Date' not in mail:
         mail['Date'] = email.utils.formatdate(utc_timestamp)