← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~sinzui/launchpad/broadcast-cc into lp:launchpad

 

Curtis Hovey has proposed merging lp:~sinzui/launchpad/broadcast-cc into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #954949 in Launchpad itself: "Contact team broadcasts to all members"
  https://bugs.launchpad.net/launchpad/+bug/954949

For more details, see:
https://code.launchpad.net/~sinzui/launchpad/broadcast-cc/+merge/104975

Pre-implementation: lifeless

Any team member can send a message to thousands of team members, but
only admins needs to do this. Many teams believe that messages from
other team members are spam. Only admins can judge if all members need
to be contacted and members should ask the admin to do this.

--------------------------------------------------------------------

RULES

    * Update ContactViaWebNotificationRecipientSet to check that the user
      is a team admin instead of team member in getPrimaryReason().


QA

    * Visit https://qastaging.launchpad.net/~launchpad/+contactuser
    * Verify the page title states you are contacting the team admins.
    * Verify the page summary states you are contacting the team admins.


LINT

    lib/lp/registry/browser/person.py
    lib/lp/registry/browser/tests/person-views.txt


TEST

    ./bin/test -vvc -t person-views -t user-to-user lp.registry.browser


IMPLEMENTATION

Changed ContactViaWebNotificationRecipientSet.getPrimaryReason() to check
that the team is one of the user's administered teams instead of checking
all team membership. Update the test to use the team admin.
    lib/lp/registry/browser/person.py
    lib/lp/registry/browser/tests/person-views.txt
-- 
https://code.launchpad.net/~sinzui/launchpad/broadcast-cc/+merge/104975
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~sinzui/launchpad/broadcast-cc into lp:launchpad.
=== modified file 'lib/lp/registry/browser/person.py'
--- lib/lp/registry/browser/person.py	2012-04-17 16:05:54 +0000
+++ lib/lp/registry/browser/person.py	2012-05-07 20:28:20 +0000
@@ -4115,12 +4115,12 @@
         :type person_or_team: `IPerson`.
         """
         if person_or_team.is_team:
-            if self.user.inTeam(person_or_team):
+            if person_or_team in self.user.getAdministratedTeams():
+                # Team admins can broadcast messages to all members.
                 return self.TO_MEMBERS
             else:
-                # A non-member can only send emails to a single person to
-                # hinder spam and to prevent leaking membership
-                # information for private teams when the members reply.
+                # A non-team-admins can make inquiries to the people who
+                # lead the team.
                 return self.TO_ADMINS
         else:
             # Send to the user

=== modified file 'lib/lp/registry/browser/tests/person-views.txt'
--- lib/lp/registry/browser/tests/person-views.txt	2012-04-10 14:01:17 +0000
+++ lib/lp/registry/browser/tests/person-views.txt	2012-05-07 20:28:20 +0000
@@ -522,11 +522,11 @@
     [u'no-priv']
 
 
-Non-member contacting a Team
-----------------------------
+Non-team-admin contacting a Team
+--------------------------------
 
-The EmailToPersonView can be used by non-members to contact the team
-owner.
+The EmailToPersonView can be used by non-team-admins to contact the team
+admins.
 
     >>> view = create_initialized_view(landscape_developers, '+contactuser')
     >>> print view.label
@@ -543,20 +543,19 @@
     [u'name12']
 
 
-Member contacting a Team
-------------------------
-
-Members can contact their team. How they are contacted depends upon
-whether the team's contact address is set. Sample Person can contact his
-team, Landscape developers, even though they do not have a contact
-address.
-
-    >>> login('test@xxxxxxxxxxxxx')
+Team admin contacting a Team
+----------------------------
+
+Team admins can contact their team to broadcast a message to all members.
+Sample Person can contact his team, Landscape developers, even though they do
+not have a contact address.
+
+    >>> team_admin = login_person(landscape_developers.adminmembers[0])
     >>> view = create_initialized_view(landscape_developers, '+index')
     >>> print view.contact_link_title
     Send an email to your team's members through Launchpad
 
-The EmailToPersonView can be used by members to contact their team.
+The EmailToPersonView can be used by admins to contact their team.
 
     >>> view = create_initialized_view(landscape_developers, '+contactuser')
     >>> print view.label


Follow ups