← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~gmb/launchpad/add-+subscriptions-page-bug-715802 into lp:launchpad

 

Graham Binns has proposed merging lp:~gmb/launchpad/add-+subscriptions-page-bug-715802 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #715802 There should be a page showing all subscriptions for a user to a bug
  https://bugs.launchpad.net/bugs/715802

For more details, see:
https://code.launchpad.net/~gmb/launchpad/add-+subscriptions-page-bug-715802/+merge/49385

This branch adds a vestigial page for the new Bug:+subscriptions view. It will be fully populated in subsequent branches once user testing has been completed.
-- 
https://code.launchpad.net/~gmb/launchpad/add-+subscriptions-page-bug-715802/+merge/49385
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~gmb/launchpad/add-+subscriptions-page-bug-715802 into lp:launchpad.
=== modified file 'lib/lp/bugs/browser/bugsubscription.py'
--- lib/lp/bugs/browser/bugsubscription.py	2011-02-04 01:15:13 +0000
+++ lib/lp/bugs/browser/bugsubscription.py	2011-02-11 12:45:46 +0000
@@ -9,6 +9,7 @@
     'BugPortletDuplicateSubcribersContents',
     'BugPortletSubcribersContents',
     'BugSubscriptionAddView',
+    'BugSubscriptionListView',
     ]
 
 import cgi
@@ -542,3 +543,14 @@
     @property
     def css_name(self):
         return 'subscriber-%s' % self.subscription.person.id
+
+
+class BugSubscriptionListView(LaunchpadView):
+    """A view to show all a person's subscriptions to a bug."""
+
+    @property
+    def label(self):
+        return "%s's subscriptions to bug %d" % (
+            self.user.displayname, self.context.bug.id)
+
+    page_title = label

=== modified file 'lib/lp/bugs/browser/configure.zcml'
--- lib/lp/bugs/browser/configure.zcml	2011-02-04 06:30:13 +0000
+++ lib/lp/bugs/browser/configure.zcml	2011-02-11 12:45:46 +0000
@@ -724,6 +724,12 @@
             template="../templates/bug-remove-question.pt"/>
         <browser:page
             for="lp.bugs.interfaces.bugtask.IBugTask"
+            name="+subscriptions"
+            class="lp.bugs.browser.bugsubscription.BugSubscriptionListView"
+            permission="launchpad.AnyPerson"
+            template="../templates/bug-subscription-list.pt"/>
+        <browser:page
+            for="lp.bugs.interfaces.bugtask.IBugTask"
             name="+subscribe"
             class="lp.bugs.browser.bugsubscription.BugSubscriptionSubscribeSelfView"
             permission="launchpad.AnyPerson"

=== modified file 'lib/lp/bugs/browser/tests/test_bugsubscription_views.py'
--- lib/lp/bugs/browser/tests/test_bugsubscription_views.py	2011-02-04 01:15:13 +0000
+++ lib/lp/bugs/browser/tests/test_bugsubscription_views.py	2011-02-11 12:45:46 +0000
@@ -266,3 +266,14 @@
         self.assertEqual(
             harness.request.response.getHeader('content-type'),
             'application/json')
+
+
+class BugSubscriptionsListViewTestCase(TestCaseWithFactory):
+    """Tests for the BugSubscriptionsListView."""
+
+    layer = LaunchpadFunctionalLayer
+
+    def setUp(self):
+        super(BugSubscriptionsListViewTestCase, self).setUp()
+        self.bug = self.factory.makeBug()
+        self.subscriber = self.factory.makePerson()

=== added file 'lib/lp/bugs/templates/bug-subscription-list.pt'
--- lib/lp/bugs/templates/bug-subscription-list.pt	1970-01-01 00:00:00 +0000
+++ lib/lp/bugs/templates/bug-subscription-list.pt	2011-02-11 12:45:46 +0000
@@ -0,0 +1,25 @@
+<html
+  xmlns="http://www.w3.org/1999/xhtml";
+  xmlns:tal="http://xml.zope.org/namespaces/tal";
+  xmlns:metal="http://xml.zope.org/namespaces/metal";
+  xmlns:i18n="http://xml.zope.org/namespaces/i18n";
+  xml:lang="en"
+  lang="en"
+  dir="ltr"
+  metal:use-macro="view/macro:page/main_only"
+  i18n:domain="malone"
+>
+
+<body>
+  <div metal:fill-slot="main">
+
+    <div id="maincontent">
+      <div id="nonportlets" class="readable">
+
+      </div>
+    </div>
+
+  </div>
+
+</body>
+</html>