Merge lp:~deryck/launchpad/no-lp-bugs-homepage-439245 into lp:launchpad

Proposed by Deryck Hodge
Status: Merged
Approved by: Deryck Hodge
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~deryck/launchpad/no-lp-bugs-homepage-439245
Merge into: lp:launchpad
Diff against target: 444 lines (+179/-176)
6 files modified
lib/lp/bugs/stories/bugs/xx-front-page-info.txt (+41/-0)
lib/lp/bugs/stories/bugs/xx-portlets-bug-series.txt (+2/-18)
lib/lp/bugs/stories/bugs/xx-product-bugs-page.txt (+0/-33)
lib/lp/bugs/stories/bugtask-searches/xx-advanced-upstream-pending-bugwatch.txt (+1/-36)
lib/lp/bugs/stories/initial-bug-contacts/10-set-upstream-bugcontact.txt (+27/-1)
lib/lp/bugs/templates/bugtarget-bugs.pt (+108/-88)
To merge this branch: bzr merge lp:~deryck/launchpad/no-lp-bugs-homepage-439245
Reviewer Review Type Date Requested Status
Martin Albisetti (community) ui Approve
Eleanor Berger (community) Approve
Review via email: mp+17634@code.launchpad.net

Commit message

Don't enable a bugs home page for projects that don't use Launchpad for bug tracking.

To post a comment you must log in.
Revision history for this message
Deryck Hodge (deryck) wrote :

= Summary =

This branch started as a fix for Bug #439245, hot bugs listed on project
bugs home when the project doesn't use Launchpad, and in the process we
decided to fix Bug #174473, project home page has search form even when
there are no bugs.

== Proposed fix ==

The fix for the first bug is to check for
view/uses_launchpad_bugtracker, and if this is the case, show the bugs
home page as it currently is on lp.net. If not, we don't show anything
on the home page and add a note that the project does not use Launchpad
for bug tracking. There is also a link provided to edit the project
details and change to use Launchpad if desired.

The fix for the second bug is to check view/hot_bugtasks as a condition
for showing the search form. If there are no hot_bugtasks, there are no
bugs filed against the project.

== Pre-implementation notes ==

This branch was done with me and Brian Fromme pairing at the bug heat
sprint, and we consulted Tom, Graham, and Gavin as needed.

== Implementation details ==

There were several broken tests to fix. In some cases, we removed the
failing sections of a test because the workflow was no longer supported.
  In other cases, we updated the test to update data or use
LaunchpadObjectFactory.

== Tests ==

Updated tests to run include:

./bin/test -cvvt xx-advanced-upstream-pending-bugwatch.txt
./bin/test -cvvt xx-portlets-bug-series.txt
./bin/test -cvvt xx-product-bugs-page.txt
./bin/test -cvvt initial-bug-contacts

We added a test to cover new functionality:

./bin/test -cvvt xx-front-page-info.txt

== Demo and Q/A ==

To demo, create a project and confirm that the bugs home page, i.e.
https://bugs.launchpad.dev/test-project/, does not list any of the
normal bugs info.

Then change the details to use malone and confirm that the page has bug
info listed.

Then, file bugs to confirm that a "Hot bugs" list appears.

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
   lib/lp/bugs/stories/bugs/xx-front-page-info.txt

lib/lp/bugs/stories/bugtask-searches/xx-advanced-upstream-pending-bugwatch.txt
   lib/lp/bugs/stories/initial-bug-contacts/10-set-upstream-bugcontact.txt
   lib/lp/bugs/templates/bugtarget-bugs.pt
   lib/lp/bugs/stories/bugs/xx-portlets-bug-series.txt
   lib/lp/bugs/stories/bugs/xx-product-bugs-page.txt

Revision history for this message
Eleanor Berger (intellectronica) wrote :

Very nice branch, great to see these bugs fixed at last. As we discussed IRL, a few very minor comments:

1. The text in the doctest reads nicer if its written consistently in present tense.
2. You can use tal:replace instead of tal:content when including the project title to save an unnecessary span element. Just think what it will do for your carbon footprint!

Finally, I'm not sure turning the search box off if no bugs are filed (on a project that does use LP) is better, because one could argue that it helps to have the UI be consistent, so that it's easy to learn. I don't feel deeply about it, but I suggest maybe running it by Martin or Michael.

review: Approve
Revision history for this message
Deryck Hodge (deryck) wrote :
Revision history for this message
Martin Albisetti (beuno) :
review: Approve (ui)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'lib/lp/bugs/stories/bugs/xx-front-page-info.txt'
--- lib/lp/bugs/stories/bugs/xx-front-page-info.txt 1970-01-01 00:00:00 +0000
+++ lib/lp/bugs/stories/bugs/xx-front-page-info.txt 2010-01-19 16:41:16 +0000
@@ -0,0 +1,41 @@
1A bugs home page for a project shows different information, depending
2on whether or not the project uses malone for bug tracking.
3
4By default, projects are created without using any bugtracker, malone
5or otherwise. To demonstrate this, a new project is created.
6
7 >>> from canonical.launchpad.ftests import login, logout
8 >>> login('foo.bar@canonical.com')
9 >>> test_project = factory.makeProduct(
10 ... name='test-project', title='Simple Test Project')
11 >>> logout()
12
13The bugs home page for the project states that the project does
14not use Launchpad for bug tracking.
15
16 >>> anon_browser.open('http://bugs.launchpad.dev/test-project')
17 >>> uses_malone_p = find_tag_by_id(anon_browser.contents, 'no-malone')
18 >>> print extract_text(uses_malone_p)
19 Simple Test Project does not use Launchpad for bug tracking.
20
21The bugs home page for a project using Launchpad for bug tracking
22shows controls for setting bug supervisor and states that no
23bugs have been filed.
24
25 >>> login('foo.bar@canonical.com')
26 >>> uses_malone = factory.makeProduct(
27 ... name='uses-malone', title='Project Uses Malone',
28 ... official_malone=True)
29 >>> logout()
30
31 >>> anon_browser.open('http://bugs.launchpad.dev/uses-malone')
32 >>> bug_supervisor = find_tag_by_id(
33 ... anon_browser.contents, 'bug-supervisor')
34 >>> print extract_text(bug_supervisor)
35 Bug supervisor:
36 None set
37
38 >>> bug_list = find_tag_by_id(
39 ... anon_browser.contents, 'no-bugs-filed')
40 >>> print extract_text(bug_list)
41 There are currently no bugs filed against Project Uses Malone.
042
=== modified file 'lib/lp/bugs/stories/bugs/xx-portlets-bug-series.txt'
--- lib/lp/bugs/stories/bugs/xx-portlets-bug-series.txt 2009-08-17 16:41:22 +0000
+++ lib/lp/bugs/stories/bugs/xx-portlets-bug-series.txt 2010-01-19 16:41:16 +0000
@@ -25,24 +25,8 @@
25 >>> print anon_browser.getLink("hoary").url25 >>> print anon_browser.getLink("hoary").url
26 http://bugs.launchpad.dev/ubuntu/hoary/+bugs26 http://bugs.launchpad.dev/ubuntu/hoary/+bugs
2727
28The same portlet is available on the bugs homepage for the distro:28The same portlet is also available for project and project series
2929listings and homepages:
30 >>> anon_browser.open("http://bugs.launchpad.dev/debian/+bugs-index")
31 >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")
32 >>> print extract_text(portlet)
33 Series-targeted bugs
34 sarge 1
35 woody 2
36
37 >>> anon_browser.open("http://bugs.launchpad.dev/debian/sarge/+bugs-index")
38 >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")
39 >>> print extract_text(portlet)
40 Series-targeted bugs
41 sarge 1
42 woody 2
43
44It's also available for project and project series listings and
45homepages:
4630
47 >>> anon_browser.open("http://bugs.launchpad.dev/firefox/+bugs")31 >>> anon_browser.open("http://bugs.launchpad.dev/firefox/+bugs")
48 >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")32 >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")
4933
=== modified file 'lib/lp/bugs/stories/bugs/xx-product-bugs-page.txt'
--- lib/lp/bugs/stories/bugs/xx-product-bugs-page.txt 2009-12-15 03:25:42 +0000
+++ lib/lp/bugs/stories/bugs/xx-product-bugs-page.txt 2010-01-19 16:41:16 +0000
@@ -44,21 +44,6 @@
44 1 Firefox does not support SVG44 1 Firefox does not support SVG
45 Low New45 Low New
4646
47The page displays the number of bugs that need forwarding upstream for
48products that do not use malone. See xx-product-pending-bugwatch for
49more explanation of why this link is present, and how it is used.
50
51 >>> anon_browser.goBack(1)
52 >>> need_forwarding_bugs_link = anon_browser.getLink(
53 ... 'Bugs need forwarding upstream')
54 Traceback (most recent call last):
55 ...
56 LinkNotFoundError
57
58 >>> anon_browser.open('http://bugs.launchpad.dev/alsa-utils')
59 >>> need_forwarding_bugs_link = anon_browser.getLink(
60 ... 'Bugs need forwarding upstream')
61
6247
63== Bugs Fixed Elsewhere ==48== Bugs Fixed Elsewhere ==
6449
@@ -80,24 +65,6 @@
80 <p>There are currently no open bugs.</p>65 <p>There are currently no open bugs.</p>
81 ...66 ...
8267
83This also works for products not using Launchpad Bugs directly. For
84example users can see all bugs raised against Mozilla Thunderbird that
85are fixed in some other context:
86
87 >>> anon_browser.open('http://bugs.launchpad.dev/thunderbird')
88 >>> fixed_elsewhere_link = anon_browser.getLink('Bugs fixed elsewhere')
89
90Again, the link takes you to the list of the bugs fixed elsewhere.:
91
92 >>> fixed_elsewhere_link.click()
93 >>> anon_browser.url
94 'http://.../+bugs?field.status_upstream=resolved_upstream'
95
96 >>> print find_main_content(anon_browser.contents)
97 <...
98 <p>There are currently no open bugs.</p>
99 ...
100
10168
102== Expirable Bugs ==69== Expirable Bugs ==
10370
10471
=== modified file 'lib/lp/bugs/stories/bugtask-searches/xx-advanced-upstream-pending-bugwatch.txt'
--- lib/lp/bugs/stories/bugtask-searches/xx-advanced-upstream-pending-bugwatch.txt 2009-10-02 15:16:03 +0000
+++ lib/lp/bugs/stories/bugtask-searches/xx-advanced-upstream-pending-bugwatch.txt 2010-01-19 16:41:16 +0000
@@ -8,20 +8,6 @@
8locate the bugs that need a bugwatch setup.8locate the bugs that need a bugwatch setup.
99
1010
11== Common searches on a product's bug page (part 1) ==
12
13No Privileges Person visits the alsa-utils front page on Launchpad.
14He wants to link Launchpad bugs to to the upstream bug tracker. He can
15see that there are '0 bugs need forwarding upstream'.
16
17 >>> user_browser.open('http://bugs.launchpad.dev/alsa-utils/')
18 >>> user_browser.title
19 'Bugs in ALSA utilities'
20
21 >>> pending_watches_link = user_browser.getLink(
22 ... 'Bugs fixed elsewhere')
23
24
25== Marking and searching for pending bugwatches ==11== Marking and searching for pending bugwatches ==
2612
27Sample Person is doing some bug reporting and triage for his adopted13Sample Person is doing some bug reporting and triage for his adopted
@@ -50,8 +36,7 @@
50chooses to search for all bugs that need to be forwarded upstream.36chooses to search for all bugs that need to be forwarded upstream.
51He sees one match.37He sees one match.
5238
53 >>> browser.open('http://bugs.launchpad.dev/alsa-utils/')39 >>> browser.open('http://bugs.launchpad.dev/alsa-utils/+bugs?advanced=1')
54 >>> browser.getLink('Advanced search').click()
55 >>> pending_bugwatch_label = (40 >>> pending_bugwatch_label = (
56 ... 'Show bugs that need to be forwarded to an upstream '41 ... 'Show bugs that need to be forwarded to an upstream '
57 ... 'bug tracker')42 ... 'bug tracker')
@@ -61,23 +46,3 @@
61 >>> print extract_text(bug_listing)46 >>> print extract_text(bug_listing)
62 Summary Importance Status47 Summary Importance Status
63 ...Test Bug 1 Undecided New48 ...Test Bug 1 Undecided New
64
65
66== Common searches on a product's bug page (part 2) ==
67
68No Privileges Person returns to the alsa-utils front page on Launchpad.
69He wants to link bugs to to the upstream bug tracker.
70
71 >>> user_browser.open('http://bugs.launchpad.dev/alsa-utils/')
72 >>> user_browser.title
73 'Bugs in ALSA utilities'
74
75 >>> pending_watches_link = user_browser.getLink(
76 ... 'Bugs need forwarding upstream')
77 >>> pending_watches_link.click()
78
79 >>> bug_listing = find_tag_by_id(user_browser.contents, 'buglisting')
80 >>> print extract_text(bug_listing)
81 Summary Importance Status
82 ...Test Bug 1 Undecided New
83
8449
=== modified file 'lib/lp/bugs/stories/initial-bug-contacts/10-set-upstream-bugcontact.txt'
--- lib/lp/bugs/stories/initial-bug-contacts/10-set-upstream-bugcontact.txt 2009-11-12 15:33:27 +0000
+++ lib/lp/bugs/stories/initial-bug-contacts/10-set-upstream-bugcontact.txt 2010-01-19 16:41:16 +0000
@@ -110,11 +110,37 @@
110 >>> sample_browser.url110 >>> sample_browser.url
111 'http://launchpad.dev/testy'111 'http://launchpad.dev/testy'
112112
113By default, a newly created project doesn't use Launchpad for bug
114tracking, and none of the bug lists or edit controls will be
115available.
116
117 >>> sample_browser.getLink('Bugs').click()
118 >>> uses_malone_p = find_tag_by_id(sample_browser.contents, 'no-malone')
119 >>> print extract_text(uses_malone_p)
120 A product for testing things does not use Launchpad for bug tracking.
121
122We can change the settings to use Launchpad for bug tracking.
123
124 >>> sample_browser.getLink(
125 ... 'Enable bug tracking.').click()
126 >>> print sample_browser.title
127 Change A product for testing things's details : Bugs : Test Product
128 >>> sample_browser.getControl('In Launchpad').click()
129 >>> sample_browser.getControl('Change').click()
130
131Now, information about bug tracking (bug supervisor, security contact)
132and their edit controls are available on the page.
133
134 >>> bug_supervisor = find_tag_by_id(
135 ... sample_browser.contents, 'bug-supervisor')
136 >>> print extract_text(bug_supervisor)
137 Bug supervisor:
138 None set
139
113Sample Person is a member of "Warty Security Team". However, he should not be140Sample Person is a member of "Warty Security Team". However, he should not be
114able to set Warty Security Team as a bug supervisor for Test Project as he's141able to set Warty Security Team as a bug supervisor for Test Project as he's
115not an admin of that team.142not an admin of that team.
116143
117 >>> sample_browser.getLink('Bugs').click()
118 >>> sample_browser.getLink('Change bug supervisor').click()144 >>> sample_browser.getLink('Change bug supervisor').click()
119 >>> sample_browser.url145 >>> sample_browser.url
120 'http://bugs.launchpad.dev/testy/+bugsupervisor'146 'http://bugs.launchpad.dev/testy/+bugsupervisor'
121147
=== modified file 'lib/lp/bugs/templates/bugtarget-bugs.pt'
--- lib/lp/bugs/templates/bugtarget-bugs.pt 2009-12-19 19:12:34 +0000
+++ lib/lp/bugs/templates/bugtarget-bugs.pt 2010-01-19 16:41:16 +0000
@@ -14,7 +14,7 @@
14 <script type="text/javascript" src="/+icing/PlotKit_Packed.js"></script>14 <script type="text/javascript" src="/+icing/PlotKit_Packed.js"></script>
15 </metal:block>15 </metal:block>
16 <body>16 <body>
17 <tal:side metal:fill-slot="side">17 <tal:side metal:fill-slot="side" condition="view/uses_launchpad_bugtracker">
18 <div id="involvement" class="portlet involvement">18 <div id="involvement" class="portlet involvement">
19 <ul>19 <ul>
20 <li style="border: none">20 <li style="border: none">
@@ -45,94 +45,114 @@
45 tal:define="search_url string:+bugs;45 tal:define="search_url string:+bugs;
46 advanced_search_url string:+bugs?advanced=1">46 advanced_search_url string:+bugs?advanced=1">
4747
48 <div class="portlet" style="float: right; border: none">48 <tal:uses_malone condition="view/uses_launchpad_bugtracker">
49 <ul>49 <div class="portlet" style="float: right; border: none">
50 <li id="bugtracker" tal:condition="not: view/uses_launchpad_bugtracker">50 <ul>
51 <strong>Bug tracker:</strong><br />51 <li id="bugtracker" tal:condition="not: view/uses_launchpad_bugtracker">
52 <span style="margin-left: 1em">52 <strong>Bug tracker:</strong><br />
53 <tal:bugtracker replace="structure view/bugtracker" />53 <span style="margin-left: 1em">
54 </span>54 <tal:bugtracker replace="structure view/bugtracker" />
55 </li>55 </span>
56 <li tal:define="bug_supervisor context/bug_supervisor">56 </li>
57 Bug supervisor:<br />57 <li id="bug-supervisor"
58 <span style="margin-left: 1em">58 tal:define="bug_supervisor context/bug_supervisor">
59 <tal:none condition="not:bug_supervisor">None set</tal:none>59 Bug supervisor:<br />
60 <a tal:condition="bug_supervisor"60 <span style="margin-left: 1em">
61 tal:replace="structure bug_supervisor/fmt:link">Bob Johnson</a>61 <tal:none condition="not:bug_supervisor">None set</tal:none>
62 <tal:edit-bug-supervisor62 <a tal:condition="bug_supervisor"
63 condition="context/menu:bugs/bugsupervisor|nothing">63 tal:replace="structure bug_supervisor/fmt:link">Bob Johnson</a>
64 <a tal:define="link context/menu:bugs/bugsupervisor"64 <tal:edit-bug-supervisor
65 tal:condition="link/enabled"65 condition="context/menu:bugs/bugsupervisor|nothing">
66 tal:attributes="href link/url; title link/text">66 <a tal:define="link context/menu:bugs/bugsupervisor"
67 <img tal:attributes="alt link/text" src="/@@/edit" />67 tal:condition="link/enabled"
68 </a> 68 tal:attributes="href link/url; title link/text">
69 </tal:edit-bug-supervisor>69 <img tal:attributes="alt link/text" src="/@@/edit" />
70 </span>70 </a>
71 </li>71 </tal:edit-bug-supervisor>
72 <li tal:define="securitycontact context/security_contact">72 </span>
73 Security contact:<br />73 </li>
74 <span style="margin-left: 1em">74 <li id="bug-security"
75 <tal:none condition="not:securitycontact">None set</tal:none>75 tal:define="securitycontact context/security_contact">
76 <a tal:condition="securitycontact"76 Security contact:<br />
77 tal:replace="structure securitycontact/fmt:link">77 <span style="margin-left: 1em">
78 Billy Anderson78 <tal:none condition="not:securitycontact">None set</tal:none>
79 </a>79 <a tal:condition="securitycontact"
80 <tal:edit-securitycontact80 tal:replace="structure securitycontact/fmt:link">
81 condition="context/menu:bugs/securitycontact|nothing">81 Billy Anderson
82 <a tal:define="link context/menu:bugs/securitycontact"
83 tal:condition="link/enabled"
84 tal:attributes="href link/url; title link/text">
85 <img tal:attributes="alt link/text" src="/@@/edit" />
86 </a>82 </a>
87 </tal:edit-securitycontact>83 <tal:edit-securitycontact
88 </span>84 condition="context/menu:bugs/securitycontact|nothing">
89 </li>85 <a tal:define="link context/menu:bugs/securitycontact"
90 <li>86 tal:condition="link/enabled"
91 </li>87 tal:attributes="href link/url; title link/text">
92 </ul>88 <img tal:attributes="alt link/text" src="/@@/edit" />
93 </div>89 </a>
9490 </tal:edit-securitycontact>
95 <div class="search-box">91 </span>
96 <metal:search92 </li>
97 use-macro="context/@@+bugtarget-macros-search/simple-search-form"93 <li>
98 />94 </li>
99 </div>95 </ul>
100 <script type="text/javascript"><!--96 </div>
101 $('field.searchtext').focus();97
102 --></script>98 <tal:has_hot_bugs condition="view/hot_bugtasks">
10399 <div class="search-box">
104 <h2 style="margin-top: 1em">Hot bugs</h2>100 <metal:search
105101 use-macro="context/@@+bugtarget-macros-search/simple-search-form"
106 <table class="listing" id="hot-bugs">102 />
107 <thead>103 </div>
108 <tr>104 <script type="text/javascript"><!--
109 <th colspan="3">Summary</th>105 $('field.searchtext').focus();
110 <th>Status</th>106 --></script>
111 <th>Importance</th>107
112 <th>Last changed</th>108 <h2 style="margin-top: 1em">Hot bugs</h2>
113 </tr>109
114 </thead>110 <table class="listing" id="hot-bugs">
115 <tbody>111 <thead>
116 <tr tal:repeat="bugtask view/hot_bugtasks">112 <tr>
117 <td class="icon left">113 <th colspan="3">Summary</th>
118 <img alt="" src="/@@/bug" />114 <th>Status</th>
119 </td>115 <th>Importance</th>
120 <td style="text-align: right">116 <th>Last changed</th>
121 #<span tal:replace="bugtask/bug/id" />117 </tr>
122 </td>118 </thead>
123 <td>119 <tbody>
124 <a tal:attributes="href bugtask/fmt:url"120 <tr tal:repeat="bugtask view/hot_bugtasks">
125 tal:content="bugtask/bug/title" />121 <td class="icon left">
126 </td>122 <img alt="" src="/@@/bug" />
127 <td tal:attributes="class string:status${bugtask/status/name}"123 </td>
128 tal:content="bugtask/status/title" />124 <td style="text-align: right">
129 <td tal:attributes="125 #<span tal:replace="bugtask/bug/id" />
130 class string:importance${bugtask/importance/name}"126 </td>
131 tal:content="bugtask/importance/title" />127 <td>
132 <td tal:content="bugtask/bug/date_last_updated/fmt:displaydate" />128 <a tal:attributes="href bugtask/fmt:url"
133 </tr>129 tal:content="bugtask/bug/title" />
134 </tbody>130 </td>
135 </table>131 <td tal:attributes="class string:status${bugtask/status/name}"
132 tal:content="bugtask/status/title" />
133 <td tal:attributes="
134 class string:importance${bugtask/importance/name}"
135 tal:content="bugtask/importance/title" />
136 <td tal:content="bugtask/bug/date_last_updated/fmt:displaydate" />
137 </tr>
138 </tbody>
139 </table>
140 </tal:has_hot_bugs>
141
142 <tal:no_hot_bugs condition="not: view/hot_bugtasks">
143 <p id="no-bugs-filed"><strong>There are currently no bugs filed against
144 <tal:project_title replace="context/title" />.</strong></p>
145
146 <p id="no-bugs-report"><a href="+filebug">Report a bug.</a></p>
147 </tal:no_hot_bugs>
148 </tal:uses_malone>
149
150 <tal:not_uses_malone condition="not: view/uses_launchpad_bugtracker">
151 <p id="no-malone"><strong><tal:project_title replace="context/title" /> does not use Launchpad for
152 bug tracking.</strong></p>
153
154 <p id="no-malone-edit"><a href="+edit">Enable bug tracking.</a></p>
155 </tal:not_uses_malone>
136156
137 </div><!-- main -->157 </div><!-- main -->
138 </body>158 </body>