[PATCH v2 5/5] parsemail: Update a Person's name upon new email unless they are registered
Doug Anderson
dianders at chromium.org
Mon Nov 18 17:00:42 EST 2013
Before this patch Patchwork didn't ever update a Person's real name.
The first time it saw an email address it looked at the name
associated with it and stashed that down as the official name. This
was a good/bad thing.
The good was:
- It's hard to change a well-known's person real name (according to
patchwork) by forging an email from them.
The bad was:
- If a person's name was wrong (or missing) in that first email, it
was that way forever.
- If a person changed their name (maybe got married?) patchwork would
never catch on to the new name.
The new rule will be that we'll update the name as long as the Person
isn't a registered patchwork user on this server. The idea here is
that someone famous enough that people might want to forge an email
from them will probably have a patchwork account and can use that to
protect themselves. Ideally this person will figure out how to get
their name changed in patchwork if they've had an actual name change.
It's not a perfect solution, but it seems like a reasonable
compromise.
Signed-off-by: Doug Anderson <dianders at chromium.org>
---
apps/patchwork/bin/parsemail.py | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/apps/patchwork/bin/parsemail.py b/apps/patchwork/bin/parsemail.py
index 92d6bb3..9d1acfe 100755
--- a/apps/patchwork/bin/parsemail.py
+++ b/apps/patchwork/bin/parsemail.py
@@ -69,15 +69,20 @@ def find_project(mail):
def find_author(mail):
name, email = parse_from(mail.get('From'))
- new_person = False
+ save_required = False
try:
person = Person.objects.get(email__iexact = email)
except Person.DoesNotExist:
person = Person(name = name, email = email)
- new_person = True
+ save_required = True
+ else:
+ # Update the name unless this is a registered user
+ if person.name != name and not person.user:
+ person.name = name
+ save_required = True
- return (person, new_person)
+ return (person, save_required)
def mail_date(mail):
t = parsedate_tz(mail.get('Date', ''))
--
1.8.4.1
More information about the Patchwork
mailing list