← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjohnston/launchpad/1270141 into lp:launchpad

 

Chris Johnston has proposed merging lp:~cjohnston/launchpad/1270141 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1270141 in Launchpad itself: "Oops when attempting register new project against team with no admins"
  https://bugs.launchpad.net/launchpad/+bug/1270141

For more details, see:
https://code.launchpad.net/~cjohnston/launchpad/1270141/+merge/222080
-- 
https://code.launchpad.net/~cjohnston/launchpad/1270141/+merge/222080
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjohnston/launchpad/1270141 into lp:launchpad.
=== modified file 'lib/lp/registry/model/person.py'
--- lib/lp/registry/model/person.py	2014-03-11 11:34:08 +0000
+++ lib/lp/registry/model/person.py	2014-06-04 17:21:05 +0000
@@ -1593,6 +1593,8 @@
         to_addrs = set()
         for admin in self.adminmembers:
             to_addrs.update(get_contact_email_addresses(admin))
+        if not to_addrs:
+            to_addrs.update(get_contact_email_addresses(self.teamowner))
         return sorted(to_addrs)
 
     def addMember(self, person, reviewer, comment=None, force_team_add=False,

=== modified file 'lib/lp/registry/tests/test_team.py'
--- lib/lp/registry/tests/test_team.py	2013-06-20 05:50:00 +0000
+++ lib/lp/registry/tests/test_team.py	2014-06-04 17:21:05 +0000
@@ -157,9 +157,10 @@
         self.assertEqual([email], self.team.getTeamAdminsEmailAddresses())
 
     def test_no_admins(self):
-        # A team without admins has no email addresses.
+        # A team without admins returns team owners email address.
         self.team.teamowner.leave(self.team)
-        self.assertEqual([], self.team.getTeamAdminsEmailAddresses())
+        email = self.team.teamowner.preferredemail.email
+        self.assertEqual([email], self.team.getTeamAdminsEmailAddresses())
 
     def test_admins_are_users_with_preferred_email_addresses(self):
         # The team's admins are users, and they provide the email addresses.