Merge lp:~cjwatson/launchpad/join-delegated-team-message into lp:launchpad

Proposed by Colin Watson
Status: Merged
Merged at revision: 18273
Proposed branch: lp:~cjwatson/launchpad/join-delegated-team-message
Merge into: lp:launchpad
Diff against target: 144 lines (+50/-13)
3 files modified
lib/lp/registry/browser/team.py (+8/-7)
lib/lp/registry/stories/teammembership/xx-teammembership.txt (+39/-3)
lib/lp/registry/templates/team-join.pt (+3/-3)
To merge this branch: bzr merge lp:~cjwatson/launchpad/join-delegated-team-message
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+310908@code.launchpad.net

Commit message

Fix misleading messages when joining a delegated team.

Description of the change

Direct membership of a delegated team requires approval by a team admin, so make the web UI reflect that.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/browser/team.py'
2--- lib/lp/registry/browser/team.py 2016-01-26 15:47:37 +0000
3+++ lib/lp/registry/browser/team.py 2016-11-15 17:53:26 +0000
4@@ -1,4 +1,4 @@
5-# Copyright 2009-2015 Canonical Ltd. This software is licensed under the
6+# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
7 # GNU Affero General Public License version 3 (see the file LICENSE).
8
9 __metaclass__ = type
10@@ -1822,13 +1822,14 @@
11 MailingListAutoSubscribePolicy.NEVER)
12
13 @property
14- def team_is_moderated(self):
15- """Is this team a moderated team?
16+ def direct_team_membership_requires_approval(self):
17+ """Does direct membership of this team require approval?
18
19- Return True if the team's membership policy is MODERATED.
20+ Return True if the team's membership policy is DELEGATED or MODERATED.
21 """
22 policy = self.context.membership_policy
23- return policy == TeamMembershipPolicy.MODERATED
24+ return policy in (
25+ TeamMembershipPolicy.DELEGATED, TeamMembershipPolicy.MODERATED)
26
27 @property
28 def next_url(self):
29@@ -1847,7 +1848,7 @@
30 # control over it.
31 self.user.join(self.context, may_subscribe_to_list=False)
32
33- if self.team_is_moderated:
34+ if self.direct_team_membership_requires_approval:
35 response.addInfoNotification(
36 _('Your request to join ${team} is awaiting '
37 'approval.',
38@@ -1872,7 +1873,7 @@
39 # all of the error cases.
40 self.context.mailing_list.subscribe(self.user)
41
42- if self.team_is_moderated:
43+ if self.direct_team_membership_requires_approval:
44 response.addInfoNotification(
45 _('Your mailing list subscription is '
46 'awaiting approval.'))
47
48=== modified file 'lib/lp/registry/stories/teammembership/xx-teammembership.txt'
49--- lib/lp/registry/stories/teammembership/xx-teammembership.txt 2016-01-26 15:47:37 +0000
50+++ lib/lp/registry/stories/teammembership/xx-teammembership.txt 2016-11-15 17:53:26 +0000
51@@ -102,8 +102,8 @@
52 >>> print find_tag_by_id(browser.contents, 'maincontent').renderContents()
53 <BLANKLINE>
54 ...
55- Since this is a moderated team, one of its administrators will have to
56- approve your membership before you actually become a member.
57+ One of this team's administrators will have to approve your membership
58+ before you actually become a member.
59 ...
60
61 If the user changes their mind because this is a moderated team, they can
62@@ -124,6 +124,39 @@
63 ... print tag.renderContents()
64 Your request to join your own team is awaiting approval.
65
66+Delegated teams also require approval of direct membership.
67+
68+ >>> login('test@canonical.com')
69+ >>> myemail.membership_policy = TeamMembershipPolicy.DELEGATED
70+ >>> myemail.syncUpdate()
71+ >>> logout()
72+
73+ >>> browser = setupBrowser(auth='Basic colin.watson@ubuntulinux.com:test')
74+ >>> browser.open('http://launchpad.dev/~myemail')
75+ >>> print extract_text(
76+ ... find_tag_by_id(browser.contents, 'subscription-policy'))
77+ Membership policy:
78+ Delegated Team
79+
80+ >>> browser.getLink('Join the team').click()
81+ >>> browser.url
82+ 'http://launchpad.dev/~myemail/+join'
83+
84+ >>> print find_tag_by_id(browser.contents, 'maincontent').renderContents()
85+ <BLANKLINE>
86+ ...
87+ One of this team's administrators will have to approve your membership
88+ before you actually become a member.
89+ ...
90+
91+ >>> browser.getControl(name='field.actions.join').click()
92+ >>> browser.url
93+ 'http://launchpad.dev/~myemail'
94+
95+ >>> for tag in find_tags_by_class(browser.contents, 'informational'):
96+ ... print tag.renderContents()
97+ Your request to join your own team is awaiting approval.
98+
99 If it was a restricted team, users wouldn't even see a link to join the team.
100
101 >>> myemail.membership_policy = TeamMembershipPolicy.RESTRICTED
102@@ -164,7 +197,8 @@
103 'http://launchpad.dev/~myemail'
104
105 On the team's +members page we can now see Karl as an approved member,
106-James Blackwell as a proposed one and Jeff Waugh won't be there at all.
107+Colin Watson and James Blackwell as proposed members, and Jeff Waugh won't
108+be there at all.
109
110 >>> anon_browser.open('http://launchpad.dev/~myemail')
111 >>> anon_browser.getLink('All members').click()
112@@ -179,6 +213,7 @@
113
114 >>> for link in find_tag_by_id(contents, 'proposedmembers').findAll('a'):
115 ... print link.renderContents()
116+ Colin Watson
117 James Blackwell
118
119
120@@ -270,6 +305,7 @@
121 >>> browser = setupBrowser(auth='Basic test@canonical.com:test')
122 >>> browser.open('http://launchpad.dev/~myemail/+members')
123 >>> print_members(browser.contents, 'proposedmembers')
124+ Colin Watson
125 James Blackwell
126
127 >>> browser.open('http://launchpad.dev/~myemail/+member/jblack')
128
129=== modified file 'lib/lp/registry/templates/team-join.pt'
130--- lib/lp/registry/templates/team-join.pt 2009-09-03 19:00:25 +0000
131+++ lib/lp/registry/templates/team-join.pt 2016-11-15 17:53:26 +0000
132@@ -12,9 +12,9 @@
133
134 <p>Are you sure you want to join this team?</p>
135
136- <p tal:condition="view/team_is_moderated">
137- Since this is a moderated team, one of its administrators will have to
138- approve your membership before you actually become a member.
139+ <p tal:condition="view/direct_team_membership_requires_approval">
140+ One of this team's administrators will have to approve your membership
141+ before you actually become a member.
142 </p>
143
144 <div metal:use-macro="context/@@launchpad_form/form" />