← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~gmb/launchpad/revert-annoying-link-bug-674815 into lp:launchpad/devel

 

Graham Binns has proposed merging lp:~gmb/launchpad/revert-annoying-link-bug-674815 into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #674815 When a bug is marked as duplicate, you are invited to subscribe to the master bug
  https://bugs.launchpad.net/bugs/674815


This branch fixes bug 674815 by (mostly) reverting the merge that introduced the +subscribe link in the bug-marked-as-dupe notification.
-- 
https://code.launchpad.net/~gmb/launchpad/revert-annoying-link-bug-674815/+merge/40876
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~gmb/launchpad/revert-annoying-link-bug-674815 into lp:launchpad/devel.
=== modified file 'lib/lp/bugs/adapters/bugchange.py'
--- lib/lp/bugs/adapters/bugchange.py	2010-09-02 10:29:37 +0000
+++ lib/lp/bugs/adapters/bugchange.py	2010-11-15 14:52:00 +0000
@@ -213,7 +213,7 @@
         lines.append(u"%13s: %s" % (
             u"Status", self.bug_task.status.title))
         return {
-            'text': '\n'.join(lines),
+            'text': '\n'.join(lines)
             }
 
 
@@ -381,16 +381,8 @@
                     "%d" % self.new_value.id)
             else:
                 new_value_text = (
-                    "** This bug has been marked a duplicate of bug "
-                    "%(bug_id)d\n   %(bug_title)s\n"
-                    " * You can subscribe to bug %(bug_id)d by following "
-                    "this link: %(subscribe_link)s" % {
-                        'bug_id': self.new_value.id,
-                        'bug_title': self.new_value.title,
-                        'subscribe_link': canonical_url(
-                            self.new_value.default_bugtask,
-                            view_name='+subscribe'),
-                        })
+                    "** This bug has been marked a duplicate of bug %d\n"
+                    "   %s" % (self.new_value.id, self.new_value.title))
 
             text = "\n".join((old_value_text, new_value_text))
 
@@ -401,16 +393,8 @@
                     "%d" % self.new_value.id)
             else:
                 text = (
-                    "** This bug has been marked a duplicate of bug "
-                    "%(bug_id)d\n   %(bug_title)s\n"
-                    " * You can subscribe to bug %(bug_id)d by following "
-                    "this link: %(subscribe_link)s" % {
-                        'bug_id': self.new_value.id,
-                        'bug_title': self.new_value.title,
-                        'subscribe_link': canonical_url(
-                            self.new_value.default_bugtask,
-                            view_name='+subscribe'),
-                        })
+                    "** This bug has been marked a duplicate of bug %d\n"
+                    "   %s" % (self.new_value.id, self.new_value.title))
 
         elif self.new_value is None:
             if self.old_value.private:
@@ -508,7 +492,7 @@
     def getBugNotification(self):
         return {
             'text': self.notification_mapping[
-                (self.old_value, self.new_value)],
+                (self.old_value, self.new_value)]
             }
 
 
@@ -701,9 +685,9 @@
             u"** Changed in: %(bug_target_name)s\n"
             "%(label)13s: %(oldval)s => %(newval)s\n" % {
                 'bug_target_name': self.bug_task.bugtargetname,
-                'label': self.display_notification_label,
-                'oldval': self.display_old_value,
-                'newval': self.display_new_value,
+                'label' : self.display_notification_label,
+                'oldval' : self.display_old_value,
+                'newval' : self.display_new_value,
             })
 
         return {'text': text.rstrip()}

=== modified file 'lib/lp/bugs/doc/bug-change.txt'
--- lib/lp/bugs/doc/bug-change.txt	2010-10-18 22:24:59 +0000
+++ lib/lp/bugs/doc/bug-change.txt	2010-11-15 14:52:00 +0000
@@ -300,7 +300,6 @@
     >>> print bug_duplicate_change.getBugNotification()['text']
     ** This bug has been marked a duplicate of bug ...
        Fish can't walk
-     * You can subscribe to bug ... by following this link:...
 
 BugDuplicateChange overrides getBugActivity() to customize all the
 returned fields.

=== modified file 'lib/lp/bugs/doc/bugnotification-sending.txt'
--- lib/lp/bugs/doc/bugnotification-sending.txt	2010-10-18 22:24:59 +0000
+++ lib/lp/bugs/doc/bugnotification-sending.txt	2010-11-15 14:52:00 +0000
@@ -341,7 +341,6 @@
     ...     print member.preferredemail.email
     marilize@xxxxxxx
 
-    >>> switch_db_to_launchpad()
     >>> bug_one.subscribe(shipit_admins, shipit_admins)
     <...>
 
@@ -349,8 +348,6 @@
     ...     'subject', 'a comment.', sample_person,
     ...     datecreated=ten_minutes_ago)
     >>> bug_one.addCommentNotification(comment)
-
-    >>> switch_db_to_bugnotification()
     >>> pending_notifications = getUtility(
     ...     IBugNotificationSet).getNotificationsToSend()
     >>> len(pending_notifications)
@@ -372,6 +369,21 @@
 Duplicates
 ----------
 
+We will need some helper functions.
+
+    >>> from canonical.config import config
+    >>> from canonical.database.sqlbase import commit
+    >>> from canonical.testing import LaunchpadZopelessLayer
+
+    >>> def switch_db_to_launchpad():
+    ...     commit()
+    ...     LaunchpadZopelessLayer.switchDbUser('launchpad')
+
+    >>> def switch_db_to_bugnotification():
+    ...     commit()
+    ...     LaunchpadZopelessLayer.switchDbUser(
+    ...         config.malone.bugnotification_dbuser)
+
 We will also need a fresh new bug.
 
     >>> from lp.bugs.interfaces.bug import CreateBugParams
@@ -539,8 +551,7 @@
     ...     '** Summary changed to: New summary.', sample_person,
     ...     when=ten_minutes_ago)
 
-    >>> notifications = getUtility(
-    ...     IBugNotificationSet).getNotificationsToSend()
+    >>> notifications = getUtility(IBugNotificationSet).getNotificationsToSend()
     >>> len(notifications)
     6
 

=== modified file 'lib/lp/bugs/tests/test_bugchanges.py'
--- lib/lp/bugs/tests/test_bugchanges.py	2010-10-04 19:50:45 +0000
+++ lib/lp/bugs/tests/test_bugchanges.py	2010-11-15 14:52:00 +0000
@@ -1292,17 +1292,8 @@
 
         expected_notification = {
             'person': self.user,
-            'text': (
-                "** This bug has been marked a duplicate of bug "
-                "%(bug_id)d\n   %(bug_title)s\n"
-                " * You can subscribe to bug %(bug_id)d by following "
-                "this link: %(subscribe_link)s" % {
-                    'bug_id': self.bug.id,
-                    'bug_title': self.bug.title,
-                    'subscribe_link': canonical_url(
-                        self.bug.default_bugtask,
-                        view_name='+subscribe'),
-                    }),
+            'text': ("** This bug has been marked a duplicate of bug %d\n"
+                     "   %s" % (self.bug.id, self.bug.title)),
             'recipients': duplicate_bug_recipients,
             }
 
@@ -1370,21 +1361,11 @@
 
         expected_notification = {
             'person': self.user,
-            'text': (
-                "** This bug is no longer a duplicate of bug "
-                "%(bug_one_id)d\n   %(bug_one_title)s\n"
-                "** This bug has been marked a duplicate of bug "
-                "%(bug_two_id)d\n   %(bug_two_title)s\n"
-                " * You can subscribe to bug %(bug_two_id)d by following "
-                "this link: %(subscribe_link)s" % {
-                    'bug_one_id': bug_one.id,
-                    'bug_one_title': bug_one.title,
-                    'bug_two_id': bug_two.id,
-                    'bug_two_title': bug_two.title,
-                    'subscribe_link': canonical_url(
-                        bug_two.default_bugtask,
-                        view_name='+subscribe'),
-                    }),
+            'text': ("** This bug is no longer a duplicate of bug %d\n"
+                     "   %s\n"
+                     "** This bug has been marked a duplicate of bug %d\n"
+                     "   %s" % (bug_one.id, bug_one.title,
+                                bug_two.id, bug_two.title)),
             'recipients': bug_recipients,
             }
 
@@ -1493,20 +1474,10 @@
         expected_notification = {
             'person': self.user,
             'text': (
-                "** This bug is no longer a duplicate of private bug "
-                "%(private_bug_id)d\n"
-                "** This bug has been marked a duplicate of bug "
-                "%(public_bug_id)d\n   %(public_bug_title)s\n"
-                " * You can subscribe to bug %(public_bug_id)d by following "
-                "this link: %(subscribe_link)s" % {
-                    'private_bug_id': private_bug.id,
-                    'private_bug_title': private_bug.title,
-                    'public_bug_id': public_bug.id,
-                    'public_bug_title': public_bug.title,
-                    'subscribe_link': canonical_url(
-                        public_bug.default_bugtask,
-                        view_name='+subscribe'),
-                    }),
+                "** This bug is no longer a duplicate of private bug %d\n"
+                "** This bug has been marked a duplicate of bug %d\n"
+                "   %s" % (private_bug.id, public_bug.id,
+                           public_bug.title)),
             'recipients': bug_recipients,
             }