launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #18429
[Merge] lp:~wgrant/launchpad/bug-1450413 into lp:launchpad
William Grant has proposed merging lp:~wgrant/launchpad/bug-1450413 into lp:launchpad.
Commit message:
Don't crash when unsubscribing from a dupe and its master simultaneously.
Requested reviews:
William Grant (wgrant): code
Related bugs:
Bug #1450413 in Launchpad itself: "BugTask:+subscribe crashes with both master and duplicate subscriptions"
https://bugs.launchpad.net/launchpad/+bug/1450413
For more details, see:
https://code.launchpad.net/~wgrant/launchpad/bug-1450413/+merge/257869
Don't crash when unsubscribing from a dupe and its master simultaneously.
--
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/bugs/browser/bugsubscription.py'
--- lib/lp/bugs/browser/bugsubscription.py 2013-04-10 08:35:47 +0000
+++ lib/lp/bugs/browser/bugsubscription.py 2015-04-30 10:25:25 +0000
@@ -525,7 +525,7 @@
plural_suffix = ""
return structured(
- " and %(num_dupes)d duplicate%(plural_suffix)s "
+ " and %(num_dupes)s duplicate%(plural_suffix)s "
"(%(dupe_links_string)s)",
num_dupes=num_dupes, plural_suffix=plural_suffix,
dupe_links_string=dupe_links_string)
=== modified file 'lib/lp/bugs/browser/tests/test_bugsubscription_views.py'
--- lib/lp/bugs/browser/tests/test_bugsubscription_views.py 2012-08-14 23:27:07 +0000
+++ lib/lp/bugs/browser/tests/test_bugsubscription_views.py 2015-04-30 10:25:25 +0000
@@ -371,6 +371,28 @@
self.assertEqual(
'bug-notification-level-field', widget_class)
+ def test_unsubscribe_from_dupes(self):
+ master = self.factory.makeBug()
+ dupe = self.factory.makeBug()
+ person = self.factory.makePerson()
+
+ with person_logged_in(person):
+ dupe.markAsDuplicate(master)
+ master.subscribe(person, person)
+ dupe.subscribe(person, person)
+ import transaction
+ transaction.commit()
+
+ v = create_initialized_view(
+ master.default_bugtask, name="+subscribe",
+ form={
+ "field.subscription": "0",
+ "field.actions.continue": "Continue"})
+ self.assertStartsWith(
+ v._getUnsubscribeNotification(person, [dupe]),
+ "You have been unsubscribed from bug %d and 1 duplicate"
+ % master.id)
+
class BugSubscriptionsListViewTestCase(TestCaseWithFactory):
"""Tests for the BugSubscriptionsListView."""
References