← Back to team overview

launchpad-reviewers team mailing list archive

lp:~brian-murray/launchpad/display-dupe-in-portlet-dupe-subscribers into lp:launchpad/devel

 

Brian Murray has proposed merging lp:~brian-murray/launchpad/display-dupe-in-portlet-dupe-subscribers into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #589349 "from duplicates" portion of subscribers portlet should show which duplicate
  https://bugs.launchpad.net/bugs/589349


When a bug has a lot of duplicates and subscribers from duplicates it would be useful to know which duplicate you were subscribed to without checking every single duplicate bug to find out.

Instead you can mouse over your name in the subscription and find out to which one you are subscribed.

Test modified:

bin/test -cvvt bugsubscription.txt xx-bug-personal-subscriptions.txt

I'd be happy to continue using the macro"bug/@@+bug-portlet-subscribers-content/subscriber-row" if you've any ideas on how to replace the title in it.  I couldn't figure out a way to do that.
-- 
https://code.launchpad.net/~brian-murray/launchpad/display-dupe-in-portlet-dupe-subscribers/+merge/34501
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~brian-murray/launchpad/display-dupe-in-portlet-dupe-subscribers into lp:launchpad/devel.
=== modified file 'lib/lp/bugs/doc/bugsubscription.txt'
--- lib/lp/bugs/doc/bugsubscription.txt	2010-08-23 09:18:51 +0000
+++ lib/lp/bugs/doc/bugsubscription.txt	2010-09-02 23:03:46 +0000
@@ -877,6 +877,6 @@
     >>> for subscription in ff_bug.getSubscriptionsFromDuplicates():
     ...     print '%s (%s)' % (
     ...         subscription.person.displayname,
-    ...         subscription.display_subscribed_by)
-    Foo Bar (Subscribed by Robert Collins)
-    Scott James Remnant (Subscribed themselves)
+    ...         subscription.display_duplicate_subscribed_by)
+    Foo Bar (Subscribed to bug 28 by Robert Collins)
+    Scott James Remnant (Subscribed themselves to bug 28)

=== modified file 'lib/lp/bugs/interfaces/bugsubscription.py'
--- lib/lp/bugs/interfaces/bugsubscription.py	2010-08-20 20:31:18 +0000
+++ lib/lp/bugs/interfaces/bugsubscription.py	2010-09-02 23:03:46 +0000
@@ -64,6 +64,9 @@
     display_subscribed_by = Attribute(
         "`subscribed_by` formatted for display.")
 
+    display_duplicate_subscribed_by = Attribute(
+        "duplicate bug `subscribed_by` formatted for display.")
+
     @call_with(user=REQUEST_USER)
     @export_read_operation()
     def canBeUnsubscribedByUser(user):

=== modified file 'lib/lp/bugs/model/bugsubscription.py'
--- lib/lp/bugs/model/bugsubscription.py	2010-08-20 20:31:18 +0000
+++ lib/lp/bugs/model/bugsubscription.py	2010-09-02 23:03:46 +0000
@@ -50,6 +50,15 @@
         else:
             return u'Subscribed by %s' % self.subscribed_by.displayname
 
+    @property
+    def display_duplicate_subscribed_by(self):
+        """See `IBugSubscription`."""
+        if self.person == self.subscribed_by:
+            return u'Subscribed themselves to bug %s' % (self.bug.id)
+        else:
+            return u'Subscribed to bug %s by %s' % (self.bug.id,
+                self.subscribed_by.displayname)
+
     def canBeUnsubscribedByUser(self, user):
         """See `IBugSubscription`."""
         if user is None:

=== modified file 'lib/lp/bugs/stories/bugs/xx-bug-personal-subscriptions.txt'
--- lib/lp/bugs/stories/bugs/xx-bug-personal-subscriptions.txt	2009-11-06 20:28:16 +0000
+++ lib/lp/bugs/stories/bugs/xx-bug-personal-subscriptions.txt	2010-09-02 23:03:46 +0000
@@ -208,7 +208,7 @@
   ...     "http://launchpad.dev/bugs/3/+bug-portlet-dupe-subscribers-content";)
   >>> print_subscribers_from_duplicates(stevea_browser.contents)
   From duplicates:
-  Steve Alexander (Subscribed by Launchpad Janitor)
+  Steve Alexander (Subscribed to bug 2 by Launchpad Janitor)
                   (Unsubscribe Steve Alexander)
 
   >>> stevea_browser.getLink(id='unsubscribe-subscriber-11').mech_link.url
@@ -267,7 +267,7 @@
   From duplicates:
   Sample Person (Subscribed ...)
   Steve Alexander (Subscribed ...) (Unsubscribe Steve Alexander)
-  testing Spanish team (Subscribed by Foo Bar)
+  testing Spanish team (Subscribed to bug 1 by Foo Bar)
 
   >>> stevea_browser.open(
   ...     "http://launchpad.dev/bugs/3/+bug-portlet-subscribers-content";)
@@ -309,7 +309,7 @@
 
   >>> print_subscribers_from_duplicates(foobar_browser.contents)
   From duplicates:
-  Ubuntu Team (Subscribed by Foo Bar) (Unsubscribe Ubuntu Team)
+  Ubuntu Team (Subscribed to bug 2 by Foo Bar) (Unsubscribe Ubuntu Team)
 
   >>> foobar_browser.open(
   ...     "http://launchpad.dev/bugs/3/+bug-portlet-subscribers-content";)

=== modified file 'lib/lp/bugs/templates/bug-portlet-dupe-subscribers-content.pt'
--- lib/lp/bugs/templates/bug-portlet-dupe-subscribers-content.pt	2009-11-05 19:01:12 +0000
+++ lib/lp/bugs/templates/bug-portlet-dupe-subscribers-content.pt	2010-09-02 23:03:46 +0000
@@ -20,8 +20,30 @@
         id string:dupe-${subscription/css_name};
       "
     >
-      <metal:subscriber
-          metal:use-macro="bug/@@+bug-portlet-subscribers-content/subscriber-row" />
+
+            <a
+               tal:condition="subscription/person/name|nothing"
+               tal:attributes="
+                 href subscription/person/fmt:url;
+                 title subscription/display_duplicate_subscribed_by;
+                 name subscription/person/fmt:displayname
+               "
+            >
+              <tal:block replace="structure subscription/person/fmt:icon" />
+              <tal:block replace="subscription/person/fmt:displayname/fmt:shorten/20" />
+            </a>
+
+            <a tal:condition="python: subscription.canBeUnsubscribedByUser(view.user)"
+               href="+subscribe"
+               tal:attributes="
+                 title string:Unsubscribe ${subscription/person/fmt:displayname};
+                 id string:unsubscribe-${subscription/css_name};
+                 class python: view.getSubscriptionClassForUser(subscription.person)
+               "
+            >
+              <img class="unsub-icon" src="/@@/remove"
+                tal:attributes="id string:unsubscribe-icon-${subscription/css_name}" />
+            </a>
     </div>
   </div>
 </div>


Follow ups