← Back to team overview

launchpad-reviewers team mailing list archive

lp:~allenap/launchpad/native-sync-real-names-in-emails-bug-827526 into lp:launchpad

 

Gavin Panella has proposed merging lp:~allenap/launchpad/native-sync-real-names-in-emails-bug-827526 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #827526 in Launchpad itself: "native sync announcement mails don't include real name"
  https://bugs.launchpad.net/launchpad/+bug/827526

For more details, see:
https://code.launchpad.net/~allenap/launchpad/native-sync-real-names-in-emails-bug-827526/+merge/72046

When announce_from_person was being specified the code was just using the person's preferredemail. This branch uses the format_address_for_person() helper to ensure that the user's real name is also included.
-- 
https://code.launchpad.net/~allenap/launchpad/native-sync-real-names-in-emails-bug-827526/+merge/72046
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/launchpad/native-sync-real-names-in-emails-bug-827526 into lp:launchpad.
=== modified file 'lib/lp/soyuz/adapters/notification.py'
--- lib/lp/soyuz/adapters/notification.py	2011-07-29 15:17:22 +0000
+++ lib/lp/soyuz/adapters/notification.py	2011-08-18 14:43:23 +0000
@@ -231,9 +231,8 @@
     info = fetch_information(spr, bprs, changes)
     from_addr = info['changedby']
     if announce_from_person is not None:
-        email = announce_from_person.preferredemail
-        if email:
-            from_addr = email.email
+        if announce_from_person.preferredemail is not None:
+            from_addr = format_address_for_person(announce_from_person)
 
     # If we're sending an acceptance notification for a non-PPA upload,
     # announce if possible. Avoid announcing backports, binary-only

=== modified file 'lib/lp/soyuz/adapters/tests/test_notification.py'
--- lib/lp/soyuz/adapters/tests/test_notification.py	2011-07-29 15:17:22 +0000
+++ lib/lp/soyuz/adapters/tests/test_notification.py	2011-08-18 14:43:23 +0000
@@ -103,7 +103,8 @@
         # the second is the announce list, which is the one that gets the
         # overridden From:
         self.assertEqual(
-            from_person.preferredemail.email, notifications[1]["From"])
+            format_address_for_person(from_person),
+            notifications[1]["From"])
 
 
 class TestNotification(TestCaseWithFactory):