← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~danilo/launchpad/devel-bug-720826-clear-level-on-delete into lp:launchpad

 

Данило Шеган has proposed merging lp:~danilo/launchpad/devel-bug-720826-clear-level-on-delete into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #720826 Add subscription description header for bug notifications
  https://bugs.launchpad.net/bugs/720826

For more details, see:
https://code.launchpad.net/~danilo/launchpad/devel-bug-720826-clear-level-on-delete/+merge/51768

= Unset bug notification level on final filter removal =

== Background ==

For every structural subscription, we have recently started enforcing that there is at least one BugSubscriptionFilter to match it.  It is initially configured to not set any filtering.

As part of QA for
https://code.launchpad.net/~danilo/launchpad/auto-create-bugsubscriptionfilter/+merge/50371

I realized that when trying to remove final subscription filter, we do not unset the bug_notification_level to the default value.

This fixes that, and can be QAd in the same manner as the above MP.

== Tests ==

bin/test -cvvt test_delete_final

== Demo and Q/A ==

Add a structural subscription and go to https://bugs.qastaging.launchpad.net/people/+me/+structural-subscriptions and first set the notification level to non-default value (eg. lifecycle) and then try deleting it and see how it gets reset.

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/bugs/model/bugsubscriptionfilter.py
  lib/lp/bugs/model/tests/test_bugsubscriptionfilter.py
-- 
https://code.launchpad.net/~danilo/launchpad/devel-bug-720826-clear-level-on-delete/+merge/51768
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~danilo/launchpad/devel-bug-720826-clear-level-on-delete into lp:launchpad.
=== modified file 'lib/lp/bugs/model/bugsubscriptionfilter.py'
--- lib/lp/bugs/model/bugsubscriptionfilter.py	2011-02-18 17:37:10 +0000
+++ lib/lp/bugs/model/bugsubscriptionfilter.py	2011-03-01 16:14:17 +0000
@@ -202,5 +202,6 @@
     def delete(self):
         """See `IBugSubscriptionFilter`."""
         self.importances = self.statuses = self.tags = ()
+        self.bug_notification_level = BugNotificationLevel.COMMENTS
         if self._has_other_filters():
             Store.of(self).remove(self)

=== modified file 'lib/lp/bugs/model/tests/test_bugsubscriptionfilter.py'
--- lib/lp/bugs/model/tests/test_bugsubscriptionfilter.py	2011-02-18 17:37:10 +0000
+++ lib/lp/bugs/model/tests/test_bugsubscriptionfilter.py	2011-03-01 16:14:17 +0000
@@ -120,6 +120,8 @@
         # Final remaining `BugSubscriptionFilter` can't be deleted.
         # Only the linked data is removed.
         bug_subscription_filter = self.subscription.bug_filters.one()
+        bug_subscription_filter.bug_notification_level = (
+            BugNotificationLevel.LIFECYCLE)
         bug_subscription_filter.importances = [BugTaskImportance.LOW]
         bug_subscription_filter.statuses = [BugTaskStatus.NEW]
         bug_subscription_filter.tags = [u"foo"]
@@ -129,6 +131,8 @@
         bug_subscription_filter.delete()
         IStore(bug_subscription_filter).flush()
         self.assertIsNot(None, Store.of(bug_subscription_filter))
+        self.assertEquals(BugNotificationLevel.COMMENTS,
+                          bug_subscription_filter.bug_notification_level)
         self.assertContentEqual([], bug_subscription_filter.statuses)
         self.assertContentEqual([], bug_subscription_filter.importances)
         self.assertContentEqual([], bug_subscription_filter.tags)