Merge lp:~gmb/launchpad/fix-ff-for-ss-bug-677020 into lp:launchpad

Proposed by Graham Binns
Status: Merged
Merged at revision: 11945
Proposed branch: lp:~gmb/launchpad/fix-ff-for-ss-bug-677020
Merge into: lp:launchpad
Diff against target: 50 lines (+17/-5)
2 files modified
lib/lp/bugs/browser/bugsubscription.py (+6/-5)
lib/lp/registry/browser/tests/test_structuralsubscription.py (+11/-0)
To merge this branch: bzr merge lp:~gmb/launchpad/fix-ff-for-ss-bug-677020
Reviewer Review Type Date Requested Status
Abel Deuring (community) code Approve
Review via email: mp+41187@code.launchpad.net

Commit message

[r=adeuring][ui=none][bug=677020] The advanced subscription features are now flagged correctly on the StructuralSubscriptionView.

Description of the change

This branch ensures that the feature-flagging of the advanced subscriptions features works for the structural subscriptions form by adding a check for the feature flag to AdvancedSubscriptionMixin.setUpBugNotificationLevelField().

To post a comment you must log in.
Revision history for this message
Abel Deuring (adeuring) wrote :

(17:24:50) abel: gmb: looks fine -- but what I don't understand is this: BugSubscriptionSubscribeSelfView.setUpFields() already calls _seUpBugNotificationLevelFiled only if the feature is enabled. Or am I missing something?
(17:25:39) gmb: abel: It's not BugSubscriptionSubscribeSelfView that's the problem, but I get your point. I'll remove that condition (the idea of my change is that whoever is using AdvancedSubscriptionMixin shouldn't have to remember to add the conditional in the first place.)
(17:26:09) abel: gmb: ah, OK, I see. so, r=me

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/bugs/browser/bugsubscription.py'
2--- lib/lp/bugs/browser/bugsubscription.py 2010-11-12 11:02:58 +0000
3+++ lib/lp/bugs/browser/bugsubscription.py 2010-11-19 09:07:59 +0000
4@@ -133,6 +133,10 @@
5
6 def _setUpBugNotificationLevelField(self):
7 """Set up the bug_notification_level field."""
8+ if not self._use_advanced_features:
9+ # If advanced features are disabled, do nothing.
10+ return
11+
12 self.form_fields = self.form_fields.omit('bug_notification_level')
13 self.form_fields += formlib.form.Fields(
14 self._bug_notification_level_field)
15@@ -263,11 +267,8 @@
16 if self.user is None:
17 return
18
19- if self._use_advanced_features:
20- self.form_fields += formlib.form.Fields(self._subscription_field)
21- self._setUpBugNotificationLevelField()
22- else:
23- self.form_fields += formlib.form.Fields(self._subscription_field)
24+ self.form_fields += formlib.form.Fields(self._subscription_field)
25+ self._setUpBugNotificationLevelField()
26 self.form_fields['subscription'].custom_widget = CustomWidgetFactory(
27 RadioWidget)
28
29
30=== modified file 'lib/lp/registry/browser/tests/test_structuralsubscription.py'
31--- lib/lp/registry/browser/tests/test_structuralsubscription.py 2010-11-10 11:33:45 +0000
32+++ lib/lp/registry/browser/tests/test_structuralsubscription.py 2010-11-19 09:07:59 +0000
33@@ -249,6 +249,17 @@
34 harness.submit('save', form_data)
35 self.assertTrue(harness.hasErrors())
36
37+ def test_extra_features_hidden_without_feature_flag(self):
38+ # If the malone.advanced-subscriptions.enabled flag is turned
39+ # off, the bug_notification_level field doesn't appear on the
40+ # form.
41+ person = self.factory.makePerson()
42+ with person_logged_in(person):
43+ harness = LaunchpadFormHarness(
44+ self.target, StructuralSubscriptionView)
45+ form_fields = harness.view.form_fields
46+ self.assertIs(
47+ None, form_fields.get('bug_notification_level'))
48
49 class TestProductSeriesAdvancedSubscriptionFeatures(
50 TestStructuralSubscriptionAdvancedFeaturesBase):