← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~matsubara/launchpad/39605-bugtask-tooltip into lp:launchpad

 

Diogo Matsubara has proposed merging lp:~matsubara/launchpad/39605-bugtask-tooltip into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #39605 in Launchpad itself: "Changed-by data for importance, milestone, etc."
  https://bugs.launchpad.net/launchpad/+bug/39605
  Bug #796765 in Launchpad itself: "typo in +initseries help text"
  https://bugs.launchpad.net/launchpad/+bug/796765

For more details, see:
https://code.launchpad.net/~matsubara/launchpad/39605-bugtask-tooltip/+merge/66928

This branch fixes two bugs:
 - bug 39605: adds a tooltip with the name of the person who made the last change to importance/status/milestone attributes in the bugtask table;
 - bug 796765: fixes typo in the +initseries context help.


-- 
https://code.launchpad.net/~matsubara/launchpad/39605-bugtask-tooltip/+merge/66928
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~matsubara/launchpad/39605-bugtask-tooltip into lp:launchpad.
=== modified file 'lib/lp/bugs/browser/bugtask.py'
--- lib/lp/bugs/browser/bugtask.py	2011-06-06 06:44:23 +0000
+++ lib/lp/bugs/browser/bugtask.py	2011-07-05 16:34:45 +0000
@@ -74,7 +74,8 @@
 from lazr.uri import URI
 from pytz import utc
 from simplejson import dumps
-from storm.expr import SQL
+from storm.expr import Desc, SQL
+from storm.zope.interfaces import IResultSet
 from z3c.ptcompat import ViewPageTemplateFile
 from zope import (
     component,
@@ -3626,6 +3627,30 @@
                 self.user_can_edit_importance and
                 not self.context.bugwatch)})
 
+    def _attr_changed_by(self, attr):
+        target_name = self.context.target.name
+        # Adapt to IResultSet so order can be changed.
+        activities = IResultSet(self.context.bug.activity)
+        # Reverse activities ordering to get the last change.
+        for activity in activities.order_by(Desc('datechanged')):
+            if (activity.target == target_name and
+                attr == activity.attribute):
+                return "Changed by: %s (%s)" % (activity.person.displayname,
+                        activity.person.name)
+        return None
+
+    @property
+    def status_changed_by(self):
+        return self._attr_changed_by('status')
+
+    @property
+    def importance_changed_by(self):
+        return self._attr_changed_by('importance')
+
+    @property
+    def milestone_changed_by(self):
+        return self._attr_changed_by('milestone')
+
 
 class BugsBugTaskSearchListingView(BugTaskSearchListingView):
     """Search all bug reports."""

=== modified file 'lib/lp/bugs/templates/bugtask-tasks-and-nominations-table-row.pt'
--- lib/lp/bugs/templates/bugtask-tasks-and-nominations-table-row.pt	2011-04-14 16:37:22 +0000
+++ lib/lp/bugs/templates/bugtask-tasks-and-nominations-table-row.pt	2011-07-05 16:34:45 +0000
@@ -70,7 +70,8 @@
            style="width: 100%; float: left">
         <a href="+editstatus"
            tal:attributes="class string:value status${context/status/name};
-                           href editstatus_url"
+                           href editstatus_url;
+                           title view/status_changed_by"
            style="float: left"
            tal:content="context/status/title" />
         <a href="+editstatus" style="margin-left: 3px"
@@ -86,7 +87,8 @@
            style="width: 100%; float: left">
         <a href="+editstatus"
            tal:attributes="class string:value importance${context/importance/name};
-                           href editstatus_url"
+                           href editstatus_url;
+                           title view/importance_changed_by"
            style="float: left"
            tal:content="context/importance/title" />
         <a href="+editstatus" style="margin-left: 3px"
@@ -100,7 +102,9 @@
       <div class="importance-content"
            style="width: 100%; float: left">
         <span
-           tal:attributes="class string:value importance${context/importance/name}"
+           tal:attributes="class string:value importance${context/importance/name};
+                           title view/importance_changed_by"
+           style="float: left"
            style="float: left"
            tal:content="context/importance/title" />
       </div>
@@ -159,7 +163,8 @@
           Target to milestone
         </a>
         <a class="value"
-           tal:attributes="href context/milestone/fmt:url | nothing"
+          tal:attributes="href context/milestone/fmt:url | nothing;
+                          title view/milestone_changed_by"
            tal:content="context/milestone/title | nothing" />
         <a tal:condition="view/user_can_edit_milestone"
            tal:attributes="href editstatus_url"

=== modified file 'lib/lp/registry/help/init-series-title-help.html'
--- lib/lp/registry/help/init-series-title-help.html	2011-04-21 09:00:39 +0000
+++ lib/lp/registry/help/init-series-title-help.html	2011-07-05 16:34:45 +0000
@@ -16,7 +16,7 @@
       development series by copying the previous one.
       </li>
       <li>A derived distribution series. This is where you have a new
-      distribution and you want to copy the packages form a series in a
+      distribution and you want to copy the packages from a series in a
       different distribution.
       </li>
   </body>