launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #01034
[Merge] lp:~brian-murray/launchpad/subscribe-oops-bug-636412 into lp:launchpad/devel
Brian Murray has proposed merging lp:~brian-murray/launchpad/subscribe-oops-bug-636412 into lp:launchpad/devel.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
#636412 UserCannotSubscribePerson error for Ubuntu
https://bugs.launchpad.net/bugs/636412
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.
--
https://code.launchpad.net/~brian-murray/launchpad/subscribe-oops-bug-636412/+merge/35459
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~brian-murray/launchpad/subscribe-oops-bug-636412 into lp:launchpad/devel.
=== 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-14 19:28:51 +0000
@@ -194,3 +194,33 @@
>>> anon_browser.open('http://launchpad.dev/bzr')
>>> print anon_browser.title
Bazaar Version Control System in Launchpad
+
+== Distribution with a bug supervisor ==
+
+If a distribution has a bug supervisor only that team or members of it can
+subscribe to all of the distribution's bugs.
+
+First, check the page content for a distribution without a bug supervisor.
+
+ >>> browser.open('http://bugs.launchpad.dev/ubuntu/+subscribe')
+ >>> text_contents = extract_text(find_main_content(browser.contents))
+ >>> "You can choose to receive an e-mail every time" in text_contents
+ True
+
+Set a bug supervisor for Ubuntu.
+
+ >>> from zope.security.proxy import removeSecurityProxy
+ >>> login('foo.bar@xxxxxxxxxxxxx')
+ >>> ubuntu = removeSecurityProxy(getUtility(IDistributionSet).get(1))
+ >>> guadamen = getUtility(IPersonSet).getByName('guadamen')
+ >>> ubuntu.bug_supervisor = guadamen
+ >>> flush_database_updates()
+ >>> logout()
+
+Second, check that the page content for a distribution with a bug supervisor
+contains a message about not being able to subscribe.
+
+ >>> browser.open('http://bugs.launchpad.dev/ubuntu/+subscribe')
+ >>> text_contents = extract_text(find_main_content(browser.contents))
+ >>> "You are unable to subscribe to bug reports about" in text_contents
+ True
=== 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-14 19:28:51 +0000
@@ -172,6 +172,10 @@
"""Return True, if the current user is subscribed."""
return self.isSubscribed(self.user)
+ def userCanAlter(self):
+ if self.context.userCanAlterBugSubscription(self.user, self.user):
+ return True
+
@action(u'Save these changes', name='save')
def save_action(self, action, data):
"""Process the subscriptions submitted by the user."""
=== 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-14 19:28:51 +0000
@@ -8,6 +8,17 @@
>
<body>
<div metal:fill-slot="main">
+ <tal:no_permissions condition="not: view/userCanAlter|nothing">
+ <p>
+ You are unable to subscribe to bug reports about <span
+ tal:replace="context/title">this item</span> as it generates a
+ large volume of e-mail regarding bug activity.
+ </p>
+ <p>
+ Contact its bug supervisor if you need more information.
+ </p>
+ </tal:no_permissions>
+ <tal:has_permissions condition="view/userCanAlter|nothing">
<p>
You can choose to receive an e-mail every time someone reports or
changes a public bug associated with
@@ -19,6 +30,7 @@
time.
</p>
<div metal:use-macro="context/@@launchpad_form/form" />
+ </tal:has_permissions>
</div>
<div metal:fill-slot="side">
<div tal:replace="structure context/@@+portlet-malone-bugmail-filtering-faq"/>