diff mbox

[v2,4/5] models: Don't munge the 'From' field of patches

Message ID 1384754442-27219-5-git-send-email-dianders@chromium.org
State Superseded
Delegated to: Stephen Finucane
Headers show

Commit Message

Doug Anderson Nov. 18, 2013, 6 a.m. UTC
At the moment patchwork always uses the official submitter name (as
patchwork understands it) as the "From" for patches that you receive.
This isn't quite what users expect and has some unfortunate
consequences.

The biggest problem is that patchwork saves the "official" name for an
email address the first time it sees an email from them.  If that name
is wrong (or was missing) patchwork will be confused even if future
emails from this person are fixed.  There are similar problems if a
user changes his/her name (get married?).

It seems better to just have each patch report the actual "From" that
was used to send that patch.  We'll still return the submitter in
'X-Patchwork-Submitter' just in case someone wants it.

Reported-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Doug Anderson <dianders@chromium.org>
---
 apps/patchwork/views/__init__.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/apps/patchwork/views/__init__.py b/apps/patchwork/views/__init__.py
index a823388..215aba9 100644
--- a/apps/patchwork/views/__init__.py
+++ b/apps/patchwork/views/__init__.py
@@ -195,7 +195,7 @@  def patch_to_mbox(patch):
 
     mail = PatchMbox(body)
     mail['Subject'] = patch.name
-    mail['From'] = email.utils.formataddr((
+    mail['X-Patchwork-Submitter'] = email.utils.formataddr((
                     str(Header(patch.submitter.name, mail.patch_charset)),
                     patch.submitter.email))
     mail['X-Patchwork-Id'] = str(patch.id)
@@ -203,7 +203,7 @@  def patch_to_mbox(patch):
     mail.set_unixfrom('From patchwork ' + patch.date.ctime())
 
 
-    copied_headers = ['To', 'Cc', 'Date']
+    copied_headers = ['To', 'Cc', 'Date', 'From']
     orig_headers = HeaderParser().parsestr(str(patch.headers))
     for header in copied_headers:
         if header in orig_headers: