← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jcsackett/launchpad/inaccessible-duplicates-link into lp:launchpad

 

j.c.sackett has proposed merging lp:~jcsackett/launchpad/inaccessible-duplicates-link into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~jcsackett/launchpad/inaccessible-duplicates-link/+merge/119781

Summary
=======
If you are on a bug that is marked as a duplicate of bug on an inactive
project, you 404 when trying to go to the master bug.

This updates the display of that information so that you are notified the bug
is a duplicate of said bug, but doesn't provide a link to it (much as when a
bug is a duplicate of a private bug).

Preimp
======
Spoke with Curtis Hovey.

Implementation
==============
The tal is updated to display a new message if the duplicateof target is
inactive in the bugtask-index template and the bug-actions-portlet template.

Tests
=====
bin/test -vvct test_bugtask

QA
==
Ensure the right message is shown on a bug that is marked as a dupe of a bug
on an inactive project.

LoC
===
This is part of disclosure.

Lint
====

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/bugs/templates/bug-portlet-actions.pt
  lib/lp/bugs/browser/tests/test_bugtask.py
  lib/lp/bugs/templates/bugtask-index.pt
-- 
https://code.launchpad.net/~jcsackett/launchpad/inaccessible-duplicates-link/+merge/119781
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jcsackett/launchpad/inaccessible-duplicates-link into lp:launchpad.
=== modified file 'lib/lp/bugs/browser/tests/test_bugtask.py'
--- lib/lp/bugs/browser/tests/test_bugtask.py	2012-08-08 11:48:29 +0000
+++ lib/lp/bugs/browser/tests/test_bugtask.py	2012-08-15 20:12:28 +0000
@@ -301,6 +301,25 @@
         view = create_initialized_view(bugtask, name="+index")
         self.assertEqual('Private', view.information_type)
 
+    def test_duplicate_message_for_inactive_dupes(self):
+        # A duplicate on an inactive project is not linked to.
+        inactive_project = self.factory.makeProduct()
+        inactive_bug = self.factory.makeBug(target=inactive_project)
+        bug = self.factory.makeBug()
+        with person_logged_in(bug.owner):
+            bug.markAsDuplicate(inactive_bug)
+        removeSecurityProxy(inactive_project).active = False
+        browser = self.getUserBrowser(canonical_url(bug))
+        contents = browser.contents
+        self.assertIn(
+            "This bug report is a duplicate of a bug on an inactive project.",
+            contents)
+
+        # Confirm there is no link to the duplicate bug.
+        soup = BeautifulSoup(contents)
+        tag = soup.find('a', attrs={'id': "duplicate-of"})
+        self.assertIsNone(tag)
+
 
 class TestBugTasksAndNominationsView(TestCaseWithFactory):
 

=== modified file 'lib/lp/bugs/templates/bug-portlet-actions.pt'
--- lib/lp/bugs/templates/bug-portlet-actions.pt	2012-08-08 11:59:48 +0000
+++ lib/lp/bugs/templates/bug-portlet-actions.pt	2012-08-15 20:12:28 +0000
@@ -29,17 +29,33 @@
         id="change-duplicate-bug"
         title="Edit or remove linked duplicate bug"
         class="sprite edit change-duplicate-bug"
-        tal:attributes="href link/url"></a><span id="mark-duplicate-text">Duplicate of
-      <a
-        tal:condition="duplicateof/required:launchpad.View"
-        tal:attributes="href duplicateof/fmt:url; title
-            duplicateof/title; style string:margin-right: 4px;
-            id string:duplicate-of;"
-        tal:content="string:bug #${duplicateof/id}"
-      >bug #42</a>
-        <span
-          tal:condition="not:duplicateof/required:launchpad.View"
-          tal:replace="string:a private bug" /></span>
+        tal:attributes="href link/url"></a>
+      <span id="mark-duplicate-text">Duplicate of
+        <tal:bug_link
+        define="dupe_active python:
+          getattr(
+            context.duplicateof.default_bugtask.target, 'active', True)">
+
+          <tal:active condition="dupe_active">
+            <a
+              tal:condition="duplicateof/required:launchpad.View"
+              tal:attributes="href duplicateof/fmt:url; title
+                  duplicateof/title; style string:margin-right: 4px;
+                  id string:duplicate-of;"
+              tal:content="string:bug #${duplicateof/id}"
+            >bug #42</a>
+            <span
+              tal:condition="not:duplicateof/required:launchpad.View"
+              tal:replace="string:a private bug" />
+          </tal:active>
+
+          <tal:inactive condition="not: dupe_active">
+            <span tal:content="string: bug #${duplicateof/id}" />
+          </tal:inactive>
+        </tal:bug_link>
+      </span>
+
+
       <a id="remove-duplicate-bug"
           href="+duplicate"
           title="Remove linked duplicate bug"

=== modified file 'lib/lp/bugs/templates/bugtask-index.pt'
--- lib/lp/bugs/templates/bugtask-index.pt	2012-08-10 04:48:36 +0000
+++ lib/lp/bugs/templates/bugtask-index.pt	2012-08-15 20:12:28 +0000
@@ -100,7 +100,13 @@
       <div id="bug-is-duplicate">
           <tal:dupe-info
              condition="duplicateof|nothing"
-             define="duplicateof context/bug/duplicateof">
+             define="duplicateof context/bug/duplicateof;
+               dupe_active python:
+                 getattr(
+                   context.bug.duplicateof.default_bugtask.target,
+                   'active', True)">
+
+          <tal:active condition="dupe_active">
           <span class="bug-duplicate-details ellipsis single-line wide">
             <span class="sprite info"></span>
             This bug report is a duplicate of:&nbsp;
@@ -112,6 +118,14 @@
                   tal:content="string:Bug #${duplicateof/id}: ${duplicateof/title}."
                 >bug #42</a>
           </span>
+          </tal:active>
+          <tal:inactive condition="not: dupe_active">
+          <span class="bug-duplicate-details ellipsis single-line wide">
+            <span class="sprite info"></span>
+            This bug report is a duplicate of a bug on an inactive project.
+          </span>
+          </tal:inactive>
+
           <a id="change-duplicate-bug-bugtasks"
             href="+duplicate"
             title="Edit or remove linked duplicate bug"


Follow ups