← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~sinzui/launchpad/buga-buga into lp:launchpad

 

Curtis Hovey has proposed merging lp:~sinzui/launchpad/buga-buga into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #136870 Link to bugs from lists of bugs in CVE pages
  https://bugs.launchpad.net/bugs/136870
  #202136 Nominating a bug for a series not a release
  https://bugs.launchpad.net/bugs/202136
  #297531 +nominate UI needs a big rework
  https://bugs.launchpad.net/bugs/297531
  #670064 Mail notification refers to "bug task" database schema
  https://bugs.launchpad.net/bugs/670064
  #674546 "See all hot bugs" link exists but lists cold bugs too
  https://bugs.launchpad.net/bugs/674546


Fix some trivial bugs in Lp bugs.

    Launchpad bug:
        https://bugs.launchpad.net/bugs/136870
        https://bugs.launchpad.net/bugs/674546
        https://bugs.launchpad.net/bugs/670064
        https://bugs.launchpad.net/bugs/202136
        https://bugs.launchpad.net/bugs/297531
    Pre-implementation: deryck
    Test command: ./bin/test -vv \
      -t cve-linking \
      -t TestAssignmentNotification \
      -t stories/bug-release-management -t test_bugnomination

Bug #136870 [Link to bugs from lists of bugs in CVE pages]
    The title of linked bugs is not linked. User need to scroll to the
    related bugs portlet and find the bug number.

Bug #674546 ["See all hot bugs" link exists but lists cold bugs too]
    This link goes to a batched list of all open bug reports for the project,
    not just the hot ones.

Bug #670064 [Mail notification refers to "bug task" database schema]
    A "bug task for a public bug"? Is that something you need a Launchpad
    diploma to understand?

Bug #202136 [Nominating a bug for a series not a release]
    Distroseries were once named distroreleases, but that was inconsistent.
    The object name was fixed, but the links still mention a release. The
    use is actually asked to choose a series, not a release

Bug #297531 [+nominate UI needs a big rework]
    The title, heading, and form alignment issues have been fixed over the
    last two years, and the view is now restricted to bug supervisors and
    drivers. The page still talks of release when it means series, and the
    action should be Nominate or Target based on user privileges.

--------------------------------------------------------------------

RULES

Bug #136870 [Link to bugs from lists of bugs in CVE pages]
    * Link the bug title in the main content if the user has permission to
      view the bug

Bug #674546 ["See all hot bugs" link exists but lists cold bugs too]
    * As mpt suggests: change the text of the link to "Show all bugs by heat".

Bug #670064 [Mail notification refers to "bug task" database schema]
    * Change the sentence as mpt suggests
      <user.unique_displayname> has assigned this bug to you for <target>
    * ADDENDUM Removed else clause for missing creator. It is not possible
      to assign someone without knowing who did it. The logic appears to
      predate the use of transitionToAssignee()

Bug #202136 [Nominating a bug for a series not a release]
    * Change the text of the link to use 'series'.

Bug #297531 [+nominate UI needs a big rework]
    * Replace "release" with "series".
    * Change the action title to "Nominate" or "Target"


QA

Bug #136870 [Link to bugs from lists of bugs in CVE pages]
    * Visit https://bugs.launchpad.net/bugs/cve/2005-0406
    * Verify the heading of the related bugs link to the bug.

Bug #674546 ["See all hot bugs" link exists but lists cold bugs too]
    * Visit https://bugs.launchpad.net/launchpad
    * Verify the link under the hot bug listing reads "Show all bugs by heat".

Bug #670064 [Mail notification refers to "bug task" database schema]
    * Assign your self a bug.
    * Verify the email does not say you were assigned a bug task.

Bug #202136 [Nominating a bug for a series not a release]
    * Visit a bug you are a driver or bug supervisor for.
    * Verify the bug states target to/nominate for series

Bug #297531 [+nominate UI needs a big rework]
    * For a project you have permission to drive or supervise,
      Choose a bug that is not nominated for a series
    * Chose Nominate/Target to series
    * Verify the page talks of "series".
    * Verify the submit button reads Nominate or Target.

LINT

    lib/lp/bugs/browser/bug.py
    lib/lp/bugs/browser/bugnomination.py
    lib/lp/bugs/browser/tests/test_bugnomination.py
    lib/lp/bugs/mail/newbug.py
    lib/lp/bugs/mail/tests/test_bug_task_assignment.py
    lib/lp/bugs/stories/bug-release-management/30-nominate-bug-for-distrorelease.txt
    lib/lp/bugs/stories/bug-release-management/40-nominate-bug-for-productseries.txt
    lib/lp/bugs/stories/bug-release-management/60-defer-product-bug.txt
    lib/lp/bugs/stories/bug-release-management/xx-anonymous-bug-nomination.txt
    lib/lp/bugs/stories/cve/cve-linking.txt
    lib/lp/bugs/templates/bug-nominate-for-series.pt
    lib/lp/bugs/templates/bugnomination-edit.pt
    lib/lp/bugs/templates/bugtarget-bugs.pt
    lib/lp/bugs/templates/cve-index.pt

^ Lint hates a lot of these files. I can clean up the indentation and line
lengths before I submit.


IMPLEMENTATION

Bug #136870 [Link to bugs from lists of bugs in CVE pages]
    Added a permission check tot he template and linked the bug if the
    user has permission to view the bug
    lib/lp/bugs/stories/cve/cve-linking.txt
    lib/lp/bugs/templates/cve-index.pt

Bug #674546 ["See all hot bugs" link exists but lists cold bugs too]
    Updated the link text in
    lib/lp/bugs/templates/bugtarget-bugs.pt

Bug #670064 [Mail notification refers to "bug task" database schema]
    Revised the message and removed the event_creator condition.
    lib/lp/bugs/mail/newbug.py
    lib/lp/bugs/mail/tests/test_bug_task_assignment.py

Bug #202136 [Nominating a bug for a series not a release]
    Update link text and test.
    lib/lp/bugs/browser/bug.py
    lib/lp/bugs/stories/bug-release-management/xx-anonymous-bug-nomination.txt

Bug #297531 [+nominate UI needs a big rework]
    Updated the templates to use series instead of release. Hacked the view
    to change the action label and added a test that is more convincing than
    the existing stories.
    lib/lp/bugs/browser/tests/test_bugnomination.py
    lib/lp/bugs/browser/bugnomination.py
    lib/lp/bugs/stories/bug-release-management/30-nominate-bug-for-distrorelease.txt
    lib/lp/bugs/stories/bug-release-management/40-nominate-bug-for-productseries.txt
    lib/lp/bugs/stories/bug-release-management/60-defer-product-bug.txt
    lib/lp/bugs/templates/bug-nominate-for-series.pt
    lib/lp/bugs/templates/bugnomination-edit.pt
-- 
https://code.launchpad.net/~sinzui/launchpad/buga-buga/+merge/44297
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~sinzui/launchpad/buga-buga into lp:launchpad.
=== modified file 'lib/lp/bugs/browser/bug.py'
--- lib/lp/bugs/browser/bug.py	2010-11-23 23:22:27 +0000
+++ lib/lp/bugs/browser/bug.py	2010-12-20 22:45:08 +0000
@@ -269,15 +269,15 @@
                 'changes'))
 
     def nominate(self):
-        """Return the 'Target/Nominate for release' Link."""
+        """Return the 'Target/Nominate for series' Link."""
         launchbag = getUtility(ILaunchBag)
         target = launchbag.product or launchbag.distribution
         if check_permission("launchpad.Driver", target):
-            text = "Target to release"
+            text = "Target to series"
             return Link('+nominate', text, icon='milestone')
         elif (check_permission("launchpad.BugSupervisor", target) or
             self.user is None):
-            text = 'Nominate for release'
+            text = 'Nominate for series'
             return Link('+nominate', text, icon='milestone')
         else:
             return Link('+nominate', '', enabled=False, icon='milestone')

=== modified file 'lib/lp/bugs/browser/bugnomination.py'
--- lib/lp/bugs/browser/bugnomination.py	2010-11-23 23:22:27 +0000
+++ lib/lp/bugs/browser/bugnomination.py	2010-12-20 22:45:08 +0000
@@ -70,6 +70,12 @@
             # been reported yet.
             raise NotFound(self.current_bugtask, '+nominate', self.request)
         LaunchpadFormView.initialize(self)
+        # Update the submit label to based on the user's permission.
+        submit_action = self.__class__.actions.byname['actions.submit']
+        if self.userIsReleaseManager():
+            submit_action.label = _("Target")
+        else:
+            submit_action.label = _("Nominate")
 
     @property
     def label(self):

=== added file 'lib/lp/bugs/browser/tests/test_bugnomination.py'
--- lib/lp/bugs/browser/tests/test_bugnomination.py	1970-01-01 00:00:00 +0000
+++ lib/lp/bugs/browser/tests/test_bugnomination.py	2010-12-20 22:45:08 +0000
@@ -0,0 +1,52 @@
+# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+"""Tests for bug nomiation views."""
+
+__metaclass__ = type
+
+from zope.component import getUtility
+
+from canonical.testing.layers import DatabaseFunctionalLayer
+from canonical.launchpad.webapp.interfaces import ILaunchBag
+from lp.testing import (
+    login_person,
+    person_logged_in,
+    TestCaseWithFactory,
+    )
+from lp.testing.views import create_initialized_view
+
+
+class TestBugNominationView(TestCaseWithFactory):
+    """Tests for BugNominationView."""
+
+    layer = DatabaseFunctionalLayer
+
+    def setUp(self):
+        super(TestBugNominationView, self).setUp()
+        self.distribution = self.factory.makeDistribution()
+        owner = self.distribution.owner
+        bug_team = self.factory.makeTeam(owner=owner)
+        self.bug_worker = self.factory.makePerson()
+        with person_logged_in(owner):
+            bug_team.addMember(self.bug_worker, owner)
+            self.distribution.setBugSupervisor(bug_team, owner)
+            self.distribution.driver = self.factory.makePerson()
+        self.bug_task = self.factory.makeBugTask(target=self.distribution)
+        launchbag = getUtility(ILaunchBag)
+        launchbag.add(self.distribution)
+        launchbag.add(self.bug_task)
+
+    def test_submit_action_bug_supervisor(self):
+        # A bug supervisor sees the Nominate action label.
+        login_person(self.bug_worker)
+        view = create_initialized_view(self.bug_task, name='+nominate')
+        action = view.__class__.actions.byname['actions.submit']
+        self.assertEqual('Nominate', action.label)
+
+    def test_submit_action_driver(self):
+        # A driver sees the Target action label.
+        login_person(self.distribution.driver)
+        view = create_initialized_view(self.bug_task, name='+nominate')
+        action = view.__class__.actions.byname['actions.submit']
+        self.assertEqual('Target', action.label)

=== modified file 'lib/lp/bugs/mail/newbug.py'
--- lib/lp/bugs/mail/newbug.py	2010-08-23 15:10:48 +0000
+++ lib/lp/bugs/mail/newbug.py	2010-12-20 22:45:08 +0000
@@ -63,11 +63,10 @@
     if new_recipients:
         if "assignee" in reason:
             contents += (
-                "You have been assigned a bug task for a %(visibility)s bug")
-            if event_creator is not None:
-                contents += " by %(assigner)s"
-                content_substitutions['assigner'] = (
-                    event_creator.unique_displayname)
+                "%(assigner)s has assigned this bug to you for %(target)s")
+            content_substitutions['assigner'] = (
+                event_creator.unique_displayname)
+            content_substitutions['target'] = bugtask.target.displayname
         else:
             contents += "You have been subscribed to a %(visibility)s bug"
         if subscribed_by is not None:

=== modified file 'lib/lp/bugs/mail/tests/test_bug_task_assignment.py'
--- lib/lp/bugs/mail/tests/test_bug_task_assignment.py	2010-10-04 19:50:45 +0000
+++ lib/lp/bugs/mail/tests/test_bug_task_assignment.py	2010-12-20 22:45:08 +0000
@@ -61,7 +61,8 @@
             ['assignee'], user=self.user))
         transaction.commit()
         self.assertEqual(len(stub.test_emails), 1, 'email not sent')
-        rationale = 'You have been assigned a bug task for a public bug by Sample Person'
+        rationale = (
+            'Sample Person (name12) has assigned this bug to you for Rebirth')
         msg = stub.test_emails[-1][2]
         self.assertTrue(rationale in msg,
                         '%s not in\n%s\n' % (rationale, msg))

=== modified file 'lib/lp/bugs/stories/bug-release-management/30-nominate-bug-for-distrorelease.txt'
--- lib/lp/bugs/stories/bug-release-management/30-nominate-bug-for-distrorelease.txt	2010-10-20 16:30:03 +0000
+++ lib/lp/bugs/stories/bug-release-management/30-nominate-bug-for-distrorelease.txt	2010-12-20 22:45:08 +0000
@@ -35,7 +35,7 @@
     ...     "http://launchpad.dev/poseidon/+source/%s/+bug/%s/+nominate"; %
     ...     (dsp.name, bug_task.bug.id))
     >>> nominater_browser.getControl("Aqua").selected = True
-    >>> nominater_browser.getControl("Submit").click()
+    >>> nominater_browser.getControl("Nominate").click()
     >>> for tag in find_tags_by_class(nominater_browser.contents, 'message'):
     ...     print tag
     <div...Added nominations for: Poseidon Aqua...
@@ -45,7 +45,7 @@
 raised.
 
     >>> nominater_other_browser.getControl("Aqua").selected = True
-    >>> nominater_other_browser.getControl("Submit").click()
+    >>> nominater_other_browser.getControl("Nominate").click()
 
     >>> for tag in find_tags_by_class(nominater_other_browser.contents,
     ...     'message'):
@@ -61,7 +61,7 @@
     ...     (dsp.name, bug_task.bug.id))
 
     >>> admin_browser.getControl("Hydro").selected = True
-    >>> admin_browser.getControl("Submit").click()
+    >>> admin_browser.getControl("Target").click()
 
     >>> for tag in find_tags_by_class(admin_browser.contents, 'message'):
     ...     print tag

=== modified file 'lib/lp/bugs/stories/bug-release-management/40-nominate-bug-for-productseries.txt'
--- lib/lp/bugs/stories/bug-release-management/40-nominate-bug-for-productseries.txt	2010-10-20 16:30:03 +0000
+++ lib/lp/bugs/stories/bug-release-management/40-nominate-bug-for-productseries.txt	2010-12-20 22:45:08 +0000
@@ -33,7 +33,7 @@
 
     >>> nominater_browser.getControl("Beta").selected = True
     >>> nominater_other_browser.getControl("Beta").selected = True
-    >>> nominater_browser.getControl("Submit").click()
+    >>> nominater_browser.getControl("Nominate").click()
 
     >>> for tag in find_tags_by_class(nominater_browser.contents, 'message'):
     ...     print tag
@@ -42,7 +42,7 @@
 Now, if the nominater, having the form open in another browser window,
 accidentally nominates the bug for Beta a second time, an error is raised.
 
-    >>> nominater_other_browser.getControl("Submit").click()
+    >>> nominater_other_browser.getControl("Nominate").click()
 
     >>> for tag in find_tags_by_class(nominater_other_browser.contents,
     ...     'message'):
@@ -57,7 +57,7 @@
     ...     "http://launchpad.dev/widget/+bug/%s/+nominate"; % bug.id)
 
     >>> admin_browser.getControl("Trunk").selected = True
-    >>> admin_browser.getControl("Submit").click()
+    >>> admin_browser.getControl("Target").click()
 
     >>> for tag in find_tags_by_class(admin_browser.contents, 'message'):
     ...     print tag

=== modified file 'lib/lp/bugs/stories/bug-release-management/60-defer-product-bug.txt'
--- lib/lp/bugs/stories/bug-release-management/60-defer-product-bug.txt	2010-10-18 20:20:01 +0000
+++ lib/lp/bugs/stories/bug-release-management/60-defer-product-bug.txt	2010-12-20 22:45:08 +0000
@@ -5,7 +5,7 @@
     >>> admin_browser.open(
     ...     "http://launchpad.dev/products/firefox/+bug/4/+nominate";)
     >>> admin_browser.getControl("Trunk").selected = True
-    >>> admin_browser.getControl("Submit").click()
+    >>> admin_browser.getControl("Target").click()
 
     >>> user_browser.open('http://bugs.launchpad.dev/firefox/+bug/4')
     >>> firefox_edit_url = (

=== modified file 'lib/lp/bugs/stories/bug-release-management/xx-anonymous-bug-nomination.txt'
--- lib/lp/bugs/stories/bug-release-management/xx-anonymous-bug-nomination.txt	2010-10-20 15:55:27 +0000
+++ lib/lp/bugs/stories/bug-release-management/xx-anonymous-bug-nomination.txt	2010-12-20 22:45:08 +0000
@@ -5,7 +5,7 @@
 
     >>> anon_browser.open('http://bugs.launchpad.dev/jokosher/+bug/12')
 
-    >>> anon_browser.getLink('Nominate for release').click()
+    >>> anon_browser.getLink('Nominate for series').click()
     Traceback (most recent call last):
       ...
     Unauthorized:...'launchpad.Edit'...

=== modified file 'lib/lp/bugs/stories/cve/cve-linking.txt'
--- lib/lp/bugs/stories/cve/cve-linking.txt	2010-10-18 22:24:59 +0000
+++ lib/lp/bugs/stories/cve/cve-linking.txt	2010-12-20 22:45:08 +0000
@@ -27,13 +27,17 @@
     >>> user_browser.getControl('Bug ID').value = '5'
     >>> user_browser.getControl('Link').click()
 
-The bug is now listed under the 'Related Bugs' heading:
+The bug is now listed under the 'Related Bugs' heading, and the bug
+title is linked
 
-    >>> print extract_text(
-    ...     find_tag_by_id(user_browser.contents, 'related-bugs'))
+    >>> content = find_tag_by_id(user_browser.contents, 'related-bugs')
+    >>> print extract_text(content)
     Related bugs and status ...
     Bug #5:...Firefox install instructions should be complete ...
 
+    >>> print content.a
+    <a href=".../bugs/5" class="sprite bug">Bug #5: ...
+
 It is also possible to link a bug using its nickname. For example,
 bug #2 has 'blackhole' as its nickname:
 

=== modified file 'lib/lp/bugs/templates/bug-nominate-for-series.pt'
--- lib/lp/bugs/templates/bug-nominate-for-series.pt	2009-09-01 14:57:35 +0000
+++ lib/lp/bugs/templates/bug-nominate-for-series.pt	2010-12-20 22:45:08 +0000
@@ -16,15 +16,15 @@
       <div metal:fill-slot="extra_info">
         <tal:targeting-mode condition="view/userIsReleaseManager">
           <p>
-          Release targeting allows you to track the status, assignee, and
-          importance of a bug in one or more official releases.
+          Series targeting allows you to track the status, assignee, and
+          importance of a bug in one or more official series.
           </p>
         </tal:targeting-mode>
 
         <tal:nomination-mode condition="not:view/userIsReleaseManager">
           <p>
           Bug nominations are evaluated by release managers and accepted
-          or declined for fixing in a release.
+          or declined for fixing in a series.
           </p>
         </tal:nomination-mode>
 

=== modified file 'lib/lp/bugs/templates/bugnomination-edit.pt'
--- lib/lp/bugs/templates/bugnomination-edit.pt	2009-09-08 15:19:00 +0000
+++ lib/lp/bugs/templates/bugnomination-edit.pt	2010-12-20 22:45:08 +0000
@@ -15,8 +15,8 @@
       </h1>
       <p>
         Approving a nomination will target the bug to be fixed in a specific
-        release. Declining a nomination will show on the bug page that this bug will
-        not be fixed in that specific release.
+        series. Declining a nomination will show on the bug page that this bug will
+        not be fixed in that specific series.
       </p>
       <div tal:content="structure context/@@+edit-form" />
     </div>

=== modified file 'lib/lp/bugs/templates/bugtarget-bugs.pt'
--- lib/lp/bugs/templates/bugtarget-bugs.pt	2010-11-23 21:24:29 +0000
+++ lib/lp/bugs/templates/bugtarget-bugs.pt	2010-12-20 22:45:08 +0000
@@ -155,7 +155,7 @@
         </table>
         <p id="more-hot-bugs"
            tal:condition="view/hot_bugs_info/has_more_bugs">
-          <a tal:attributes="href string:${context/fmt:url/+bugs}?orderby=-heat&field.status%3Alist=NEW&field.status%3Alist=INCOMPLETE_WITH_RESPONSE&field.status%3Alist=INCOMPLETE_WITHOUT_RESPONSE&field.status%3Alist=CONFIRMED&field.status%3Alist=TRIAGED&field.status%3Alist=INPROGRESS&field.status%3Alist=FIXCOMMITTED&field.omit_dupes=on">See all hot bugs</a>
+          <a tal:attributes="href string:${context/fmt:url/+bugs}?orderby=-heat&field.status%3Alist=NEW&field.status%3Alist=INCOMPLETE_WITH_RESPONSE&field.status%3Alist=INCOMPLETE_WITHOUT_RESPONSE&field.status%3Alist=CONFIRMED&field.status%3Alist=TRIAGED&field.status%3Alist=INPROGRESS&field.status%3Alist=FIXCOMMITTED&field.omit_dupes=on">Show all bugs by heat</a>
         </p>
       </div>
 

=== modified file 'lib/lp/bugs/templates/cve-index.pt'
--- lib/lp/bugs/templates/cve-index.pt	2009-11-14 22:05:18 +0000
+++ lib/lp/bugs/templates/cve-index.pt	2010-12-20 22:45:08 +0000
@@ -31,8 +31,15 @@
     </p>
 
     <div tal:repeat="link view/buglinks">
-      <strong class="sprite bug">Bug #<span tal:replace="link/bug/id" />:
-         <span tal:replace="link/title" /></strong>
+      <strong>
+        <a tal:condition="link/bug/required:launchpad.View"
+          tal:replace="structure link/bug/fmt:link"/>
+        <span class="sprite bug"
+          tal:condition="not: link/bug/required:launchpad.View">
+          Bug #<tal:number replace="link/bug/id" />:
+          <tal:title replace="link/title" />
+        </span>
+      </strong>
       <tal:details condition="link/can_view_bug">
         <div
           tal:replace="structure link/bug/@@+bugtasks-and-nominations-table" />
@@ -40,7 +47,7 @@
     </div>
   </div>
 
-  <div style="margin-top: 1em">  
+  <div style="margin-top: 1em">
     See the <img src="/@@/link" />
     <a tal:attributes="href context/url">CVE page on Mitre.org</a>
     for more details.