← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Graham Binns has proposed merging lp:~gmb/launchpad/fix-ff-for-ss-bug-677020 into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #677020 Extra options for structural subscriptions show up despite feature flag
  https://bugs.launchpad.net/bugs/677020


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().
-- 
https://code.launchpad.net/~gmb/launchpad/fix-ff-for-ss-bug-677020/+merge/41187
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~gmb/launchpad/fix-ff-for-ss-bug-677020 into lp:launchpad/devel.
=== modified file 'lib/lp/bugs/browser/bugsubscription.py'
--- lib/lp/bugs/browser/bugsubscription.py	2010-11-12 11:02:58 +0000
+++ lib/lp/bugs/browser/bugsubscription.py	2010-11-18 16:18:15 +0000
@@ -133,6 +133,10 @@
 
     def _setUpBugNotificationLevelField(self):
         """Set up the bug_notification_level field."""
+        if not self._use_advanced_features:
+            # If advanced features are disabled, do nothing.
+            return
+
         self.form_fields = self.form_fields.omit('bug_notification_level')
         self.form_fields += formlib.form.Fields(
             self._bug_notification_level_field)

=== modified file 'lib/lp/registry/browser/tests/test_structuralsubscription.py'
--- lib/lp/registry/browser/tests/test_structuralsubscription.py	2010-11-10 11:33:45 +0000
+++ lib/lp/registry/browser/tests/test_structuralsubscription.py	2010-11-18 16:18:15 +0000
@@ -249,6 +249,17 @@
                 harness.submit('save', form_data)
                 self.assertTrue(harness.hasErrors())
 
+    def test_extra_features_hidden_without_feature_flag(self):
+        # If the malone.advanced-subscriptions.enabled flag is turned
+        # off, the bug_notification_level field doesn't appear on the
+        # form.
+        person = self.factory.makePerson()
+        with person_logged_in(person):
+            harness = LaunchpadFormHarness(
+                self.target, StructuralSubscriptionView)
+            form_fields = harness.view.form_fields
+            self.assertIs(
+                None, form_fields.get('bug_notification_level'))
 
 class TestProductSeriesAdvancedSubscriptionFeatures(
     TestStructuralSubscriptionAdvancedFeaturesBase):