Merge lp:~brian-murray/launchpad/subscribe-oops-bug-636412 into lp:launchpad

Proposed by Brian Murray
Status: Merged
Approved by: Curtis Hovey
Approved revision: no longer in the source branch.
Merged at revision: 11560
Proposed branch: lp:~brian-murray/launchpad/subscribe-oops-bug-636412
Merge into: lp:launchpad
Diff against target: 85 lines (+49/-0)
3 files modified
lib/lp/bugs/stories/structural-subscriptions/xx-bug-subscriptions.txt (+30/-0)
lib/lp/registry/browser/structuralsubscription.py (+4/-0)
lib/lp/registry/templates/structural-subscriptions-manage.pt (+15/-0)
To merge this branch: bzr merge lp:~brian-murray/launchpad/subscribe-oops-bug-636412
Reviewer Review Type Date Requested Status
Curtis Hovey (community) ui Approve
Māris Fogels (community) Approve
Review via email: mp+35459@code.launchpad.net

Commit message

Don't display the +subscribe form for bug targets for people who cannot subscribe to the bug target.

Description of the change

Although the +subscribe link is no longer being displayed for distributions with a bug supervisor it seems that some people are still making it to launchpad.net/ubuntu/+subscribe and generating Oops reports by trying to subscribe.

To fix this I've made the form and the text preceding it conditional on whether or not one has the permission to subscribe to the bug reports about the bug target.

I've also added a test for this to xx-bug-subscriptions.txt.

To post a comment you must log in.
Revision history for this message
Māris Fogels (mars) wrote :

Hi Brian,

This change looks good. r=mars.

May I suggest a small tweak to the wording to mention the reason why we are protecting the users from our system? Something like this:

    You are unable to subscribe to bug reports about the Ubuntu project because it generates too much bug-related e-mail for most users to cope with.

    If you really want to subscribe this project's bugmail then please contact the Ubuntu project bug supervisor.

Best,

Maris

review: Approve
Revision history for this message
Curtis Hovey (sinzui) wrote :

Thanks for addressing this oops. This looks good to land.

review: Approve (ui)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/bugs/stories/structural-subscriptions/xx-bug-subscriptions.txt'
--- lib/lp/bugs/stories/structural-subscriptions/xx-bug-subscriptions.txt 2010-05-21 04:38:42 +0000
+++ lib/lp/bugs/stories/structural-subscriptions/xx-bug-subscriptions.txt 2010-09-16 13:11:49 +0000
@@ -194,3 +194,33 @@
194 >>> anon_browser.open('http://launchpad.dev/bzr')194 >>> anon_browser.open('http://launchpad.dev/bzr')
195 >>> print anon_browser.title195 >>> print anon_browser.title
196 Bazaar Version Control System in Launchpad196 Bazaar Version Control System in Launchpad
197
198== Distribution with a bug supervisor ==
199
200If a distribution has a bug supervisor only that team or members of it can
201subscribe to all of the distribution's bugs.
202
203First, check the page content for a distribution without a bug supervisor.
204
205 >>> browser.open('http://bugs.launchpad.dev/ubuntu/+subscribe')
206 >>> text_contents = extract_text(find_main_content(browser.contents))
207 >>> "You can choose to receive an e-mail every time" in text_contents
208 True
209
210Set a bug supervisor for Ubuntu.
211
212 >>> from zope.security.proxy import removeSecurityProxy
213 >>> login('foo.bar@canonical.com')
214 >>> ubuntu = removeSecurityProxy(getUtility(IDistributionSet).get(1))
215 >>> guadamen = getUtility(IPersonSet).getByName('guadamen')
216 >>> ubuntu.bug_supervisor = guadamen
217 >>> flush_database_updates()
218 >>> logout()
219
220Second, check that the page content for a distribution with a bug supervisor
221contains a message about not being able to subscribe.
222
223 >>> browser.open('http://bugs.launchpad.dev/ubuntu/+subscribe')
224 >>> text_contents = extract_text(find_main_content(browser.contents))
225 >>> "You are unable to subscribe to bug reports about" in text_contents
226 True
197227
=== modified file 'lib/lp/registry/browser/structuralsubscription.py'
--- lib/lp/registry/browser/structuralsubscription.py 2010-08-24 10:45:57 +0000
+++ lib/lp/registry/browser/structuralsubscription.py 2010-09-16 13:11:49 +0000
@@ -172,6 +172,10 @@
172 """Return True, if the current user is subscribed."""172 """Return True, if the current user is subscribed."""
173 return self.isSubscribed(self.user)173 return self.isSubscribed(self.user)
174174
175 def userCanAlter(self):
176 if self.context.userCanAlterBugSubscription(self.user, self.user):
177 return True
178
175 @action(u'Save these changes', name='save')179 @action(u'Save these changes', name='save')
176 def save_action(self, action, data):180 def save_action(self, action, data):
177 """Process the subscriptions submitted by the user."""181 """Process the subscriptions submitted by the user."""
178182
=== modified file 'lib/lp/registry/templates/structural-subscriptions-manage.pt'
--- lib/lp/registry/templates/structural-subscriptions-manage.pt 2009-12-05 18:37:28 +0000
+++ lib/lp/registry/templates/structural-subscriptions-manage.pt 2010-09-16 13:11:49 +0000
@@ -8,6 +8,20 @@
8>8>
9<body>9<body>
10 <div metal:fill-slot="main">10 <div metal:fill-slot="main">
11 <tal:no_permissions condition="not: view/userCanAlter|nothing">
12 <p>
13 You are unable to subscribe to bug reports about <span
14 tal:replace="context/title">this item</span> as it generates
15 a high amount of bug activity which results in more e-mails than
16 most users can handle.
17 </p>
18 <p>
19 If you really want to subscribe to <span
20 tal:replace="context/title">this item</span> bug mail than
21 please contact its bug supervisor.
22 </p>
23 </tal:no_permissions>
24 <tal:has_permissions condition="view/userCanAlter|nothing">
11 <p>25 <p>
12 You can choose to receive an e-mail every time someone reports or26 You can choose to receive an e-mail every time someone reports or
13 changes a public bug associated with 27 changes a public bug associated with
@@ -19,6 +33,7 @@
19 time.33 time.
20 </p>34 </p>
21 <div metal:use-macro="context/@@launchpad_form/form" />35 <div metal:use-macro="context/@@launchpad_form/form" />
36 </tal:has_permissions>
22 </div>37 </div>
23 <div metal:fill-slot="side">38 <div metal:fill-slot="side">
24 <div tal:replace="structure context/@@+portlet-malone-bugmail-filtering-faq"/>39 <div tal:replace="structure context/@@+portlet-malone-bugmail-filtering-faq"/>