launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #03841
lp:~gmb/launchpad/bug-772609-hopefully-without-breaking-anything-this-time into lp:launchpad
Graham Binns has proposed merging lp:~gmb/launchpad/bug-772609-hopefully-without-breaking-anything-this-time into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #772609 in Launchpad itself: "bug subscription mute link is not shown for membership in a team with a direct or structural subscription"
https://bugs.launchpad.net/launchpad/+bug/772609
For more details, see:
https://code.launchpad.net/~gmb/launchpad/bug-772609-hopefully-without-breaking-anything-this-time/+merge/63432
This branch contains a fix for a bug with code that's feature flagged being exposed to anonymous users.
It's a simple fix - I short-circuited the two @properties suffering from it - and I've added a test to cover the change.
--
https://code.launchpad.net/~gmb/launchpad/bug-772609-hopefully-without-breaking-anything-this-time/+merge/63432
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~gmb/launchpad/bug-772609-hopefully-without-breaking-anything-this-time into lp:launchpad.
=== modified file 'lib/lp/bugs/browser/bug.py'
--- lib/lp/bugs/browser/bug.py 2011-05-20 12:37:14 +0000
+++ lib/lp/bugs/browser/bug.py 2011-06-03 21:33:33 +0000
@@ -506,6 +506,9 @@
@property
def current_user_subscription_class(self):
+ if not self.user:
+ return 'subscribed-false dup-subscribed-false'
+
bug = self.context
if bug.personIsSubscribedToDuplicate(self.user):
@@ -521,6 +524,10 @@
@property
def current_user_mute_class(self):
+ if not self.user:
+ return 'muted-false hidden %s' % (
+ self.current_user_subscription_class)
+
bug = self.context
subscription_class = self.current_user_subscription_class
if self.user_should_see_mute_link:
=== modified file 'lib/lp/bugs/browser/tests/test_bug_views.py'
--- lib/lp/bugs/browser/tests/test_bug_views.py 2011-06-01 10:40:44 +0000
+++ lib/lp/bugs/browser/tests/test_bug_views.py 2011-06-03 21:33:33 +0000
@@ -263,3 +263,15 @@
self.bug.default_bugtask, name="+mute",
form={'field.actions.mute': 'Mute bug mail'})
self.assertTrue(self.bug.isMuted(person))
+
+ def test_mute_classes_work_for_anonymous_users(self):
+ # If a user is not logged in, the template shouldn't break
+ # horribly.
+ bug = self.factory.makeBug()
+ view = create_initialized_view(bug.default_bugtask, name="+index")
+ self.assertEqual(
+ 'subscribed-false dup-subscribed-false',
+ view.current_user_subscription_class)
+ self.assertEqual(
+ 'muted-false hidden subscribed-false dup-subscribed-false',
+ view.current_user_mute_class)