launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #21222
[Merge] lp:~cjwatson/launchpad/join-delegated-team-message into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/join-delegated-team-message into lp:launchpad.
Commit message:
Fix misleading messages when joining a delegated team.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/join-delegated-team-message/+merge/310908
Direct membership of a delegated team requires approval by a team admin, so make the web UI reflect that.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/join-delegated-team-message into lp:launchpad.
=== modified file 'lib/lp/registry/browser/team.py'
--- lib/lp/registry/browser/team.py 2016-01-26 15:47:37 +0000
+++ lib/lp/registry/browser/team.py 2016-11-15 17:53:26 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2015 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
@@ -1822,13 +1822,14 @@
MailingListAutoSubscribePolicy.NEVER)
@property
- def team_is_moderated(self):
- """Is this team a moderated team?
+ def direct_team_membership_requires_approval(self):
+ """Does direct membership of this team require approval?
- Return True if the team's membership policy is MODERATED.
+ Return True if the team's membership policy is DELEGATED or MODERATED.
"""
policy = self.context.membership_policy
- return policy == TeamMembershipPolicy.MODERATED
+ return policy in (
+ TeamMembershipPolicy.DELEGATED, TeamMembershipPolicy.MODERATED)
@property
def next_url(self):
@@ -1847,7 +1848,7 @@
# control over it.
self.user.join(self.context, may_subscribe_to_list=False)
- if self.team_is_moderated:
+ if self.direct_team_membership_requires_approval:
response.addInfoNotification(
_('Your request to join ${team} is awaiting '
'approval.',
@@ -1872,7 +1873,7 @@
# all of the error cases.
self.context.mailing_list.subscribe(self.user)
- if self.team_is_moderated:
+ if self.direct_team_membership_requires_approval:
response.addInfoNotification(
_('Your mailing list subscription is '
'awaiting approval.'))
=== modified file 'lib/lp/registry/stories/teammembership/xx-teammembership.txt'
--- lib/lp/registry/stories/teammembership/xx-teammembership.txt 2016-01-26 15:47:37 +0000
+++ lib/lp/registry/stories/teammembership/xx-teammembership.txt 2016-11-15 17:53:26 +0000
@@ -102,8 +102,8 @@
>>> print find_tag_by_id(browser.contents, 'maincontent').renderContents()
<BLANKLINE>
...
- Since this is a moderated team, one of its administrators will have to
- approve your membership before you actually become a member.
+ One of this team's administrators will have to approve your membership
+ before you actually become a member.
...
If the user changes their mind because this is a moderated team, they can
@@ -124,6 +124,39 @@
... print tag.renderContents()
Your request to join your own team is awaiting approval.
+Delegated teams also require approval of direct membership.
+
+ >>> login('test@xxxxxxxxxxxxx')
+ >>> myemail.membership_policy = TeamMembershipPolicy.DELEGATED
+ >>> myemail.syncUpdate()
+ >>> logout()
+
+ >>> browser = setupBrowser(auth='Basic colin.watson@xxxxxxxxxxxxxxx:test')
+ >>> browser.open('http://launchpad.dev/~myemail')
+ >>> print extract_text(
+ ... find_tag_by_id(browser.contents, 'subscription-policy'))
+ Membership policy:
+ Delegated Team
+
+ >>> browser.getLink('Join the team').click()
+ >>> browser.url
+ 'http://launchpad.dev/~myemail/+join'
+
+ >>> print find_tag_by_id(browser.contents, 'maincontent').renderContents()
+ <BLANKLINE>
+ ...
+ One of this team's administrators will have to approve your membership
+ before you actually become a member.
+ ...
+
+ >>> browser.getControl(name='field.actions.join').click()
+ >>> browser.url
+ 'http://launchpad.dev/~myemail'
+
+ >>> for tag in find_tags_by_class(browser.contents, 'informational'):
+ ... print tag.renderContents()
+ Your request to join your own team is awaiting approval.
+
If it was a restricted team, users wouldn't even see a link to join the team.
>>> myemail.membership_policy = TeamMembershipPolicy.RESTRICTED
@@ -164,7 +197,8 @@
'http://launchpad.dev/~myemail'
On the team's +members page we can now see Karl as an approved member,
-James Blackwell as a proposed one and Jeff Waugh won't be there at all.
+Colin Watson and James Blackwell as proposed members, and Jeff Waugh won't
+be there at all.
>>> anon_browser.open('http://launchpad.dev/~myemail')
>>> anon_browser.getLink('All members').click()
@@ -179,6 +213,7 @@
>>> for link in find_tag_by_id(contents, 'proposedmembers').findAll('a'):
... print link.renderContents()
+ Colin Watson
James Blackwell
@@ -270,6 +305,7 @@
>>> browser = setupBrowser(auth='Basic test@xxxxxxxxxxxxx:test')
>>> browser.open('http://launchpad.dev/~myemail/+members')
>>> print_members(browser.contents, 'proposedmembers')
+ Colin Watson
James Blackwell
>>> browser.open('http://launchpad.dev/~myemail/+member/jblack')
=== modified file 'lib/lp/registry/templates/team-join.pt'
--- lib/lp/registry/templates/team-join.pt 2009-09-03 19:00:25 +0000
+++ lib/lp/registry/templates/team-join.pt 2016-11-15 17:53:26 +0000
@@ -12,9 +12,9 @@
<p>Are you sure you want to join this team?</p>
- <p tal:condition="view/team_is_moderated">
- Since this is a moderated team, one of its administrators will have to
- approve your membership before you actually become a member.
+ <p tal:condition="view/direct_team_membership_requires_approval">
+ One of this team's administrators will have to approve your membership
+ before you actually become a member.
</p>
<div metal:use-macro="context/@@launchpad_form/form" />
Follow ups