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
1=== added file 'lib/lp/bugs/stories/bugs/xx-front-page-info.txt'
2--- lib/lp/bugs/stories/bugs/xx-front-page-info.txt 1970-01-01 00:00:00 +0000
3+++ lib/lp/bugs/stories/bugs/xx-front-page-info.txt 2010-01-19 16:41:16 +0000
4@@ -0,0 +1,41 @@
5+A bugs home page for a project shows different information, depending
6+on whether or not the project uses malone for bug tracking.
7+
8+By default, projects are created without using any bugtracker, malone
9+or otherwise. To demonstrate this, a new project is created.
10+
11+ >>> from canonical.launchpad.ftests import login, logout
12+ >>> login('foo.bar@canonical.com')
13+ >>> test_project = factory.makeProduct(
14+ ... name='test-project', title='Simple Test Project')
15+ >>> logout()
16+
17+The bugs home page for the project states that the project does
18+not use Launchpad for bug tracking.
19+
20+ >>> anon_browser.open('http://bugs.launchpad.dev/test-project')
21+ >>> uses_malone_p = find_tag_by_id(anon_browser.contents, 'no-malone')
22+ >>> print extract_text(uses_malone_p)
23+ Simple Test Project does not use Launchpad for bug tracking.
24+
25+The bugs home page for a project using Launchpad for bug tracking
26+shows controls for setting bug supervisor and states that no
27+bugs have been filed.
28+
29+ >>> login('foo.bar@canonical.com')
30+ >>> uses_malone = factory.makeProduct(
31+ ... name='uses-malone', title='Project Uses Malone',
32+ ... official_malone=True)
33+ >>> logout()
34+
35+ >>> anon_browser.open('http://bugs.launchpad.dev/uses-malone')
36+ >>> bug_supervisor = find_tag_by_id(
37+ ... anon_browser.contents, 'bug-supervisor')
38+ >>> print extract_text(bug_supervisor)
39+ Bug supervisor:
40+ None set
41+
42+ >>> bug_list = find_tag_by_id(
43+ ... anon_browser.contents, 'no-bugs-filed')
44+ >>> print extract_text(bug_list)
45+ There are currently no bugs filed against Project Uses Malone.
46
47=== modified file 'lib/lp/bugs/stories/bugs/xx-portlets-bug-series.txt'
48--- lib/lp/bugs/stories/bugs/xx-portlets-bug-series.txt 2009-08-17 16:41:22 +0000
49+++ lib/lp/bugs/stories/bugs/xx-portlets-bug-series.txt 2010-01-19 16:41:16 +0000
50@@ -25,24 +25,8 @@
51 >>> print anon_browser.getLink("hoary").url
52 http://bugs.launchpad.dev/ubuntu/hoary/+bugs
53
54-The same portlet is available on the bugs homepage for the distro:
55-
56- >>> anon_browser.open("http://bugs.launchpad.dev/debian/+bugs-index")
57- >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")
58- >>> print extract_text(portlet)
59- Series-targeted bugs
60- sarge 1
61- woody 2
62-
63- >>> anon_browser.open("http://bugs.launchpad.dev/debian/sarge/+bugs-index")
64- >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")
65- >>> print extract_text(portlet)
66- Series-targeted bugs
67- sarge 1
68- woody 2
69-
70-It's also available for project and project series listings and
71-homepages:
72+The same portlet is also available for project and project series
73+listings and homepages:
74
75 >>> anon_browser.open("http://bugs.launchpad.dev/firefox/+bugs")
76 >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")
77
78=== modified file 'lib/lp/bugs/stories/bugs/xx-product-bugs-page.txt'
79--- lib/lp/bugs/stories/bugs/xx-product-bugs-page.txt 2009-12-15 03:25:42 +0000
80+++ lib/lp/bugs/stories/bugs/xx-product-bugs-page.txt 2010-01-19 16:41:16 +0000
81@@ -44,21 +44,6 @@
82 1 Firefox does not support SVG
83 Low New
84
85-The page displays the number of bugs that need forwarding upstream for
86-products that do not use malone. See xx-product-pending-bugwatch for
87-more explanation of why this link is present, and how it is used.
88-
89- >>> anon_browser.goBack(1)
90- >>> need_forwarding_bugs_link = anon_browser.getLink(
91- ... 'Bugs need forwarding upstream')
92- Traceback (most recent call last):
93- ...
94- LinkNotFoundError
95-
96- >>> anon_browser.open('http://bugs.launchpad.dev/alsa-utils')
97- >>> need_forwarding_bugs_link = anon_browser.getLink(
98- ... 'Bugs need forwarding upstream')
99-
100
101 == Bugs Fixed Elsewhere ==
102
103@@ -80,24 +65,6 @@
104 <p>There are currently no open bugs.</p>
105 ...
106
107-This also works for products not using Launchpad Bugs directly. For
108-example users can see all bugs raised against Mozilla Thunderbird that
109-are fixed in some other context:
110-
111- >>> anon_browser.open('http://bugs.launchpad.dev/thunderbird')
112- >>> fixed_elsewhere_link = anon_browser.getLink('Bugs fixed elsewhere')
113-
114-Again, the link takes you to the list of the bugs fixed elsewhere.:
115-
116- >>> fixed_elsewhere_link.click()
117- >>> anon_browser.url
118- 'http://.../+bugs?field.status_upstream=resolved_upstream'
119-
120- >>> print find_main_content(anon_browser.contents)
121- <...
122- <p>There are currently no open bugs.</p>
123- ...
124-
125
126 == Expirable Bugs ==
127
128
129=== modified file 'lib/lp/bugs/stories/bugtask-searches/xx-advanced-upstream-pending-bugwatch.txt'
130--- lib/lp/bugs/stories/bugtask-searches/xx-advanced-upstream-pending-bugwatch.txt 2009-10-02 15:16:03 +0000
131+++ lib/lp/bugs/stories/bugtask-searches/xx-advanced-upstream-pending-bugwatch.txt 2010-01-19 16:41:16 +0000
132@@ -8,20 +8,6 @@
133 locate the bugs that need a bugwatch setup.
134
135
136-== Common searches on a product's bug page (part 1) ==
137-
138-No Privileges Person visits the alsa-utils front page on Launchpad.
139-He wants to link Launchpad bugs to to the upstream bug tracker. He can
140-see that there are '0 bugs need forwarding upstream'.
141-
142- >>> user_browser.open('http://bugs.launchpad.dev/alsa-utils/')
143- >>> user_browser.title
144- 'Bugs in ALSA utilities'
145-
146- >>> pending_watches_link = user_browser.getLink(
147- ... 'Bugs fixed elsewhere')
148-
149-
150 == Marking and searching for pending bugwatches ==
151
152 Sample Person is doing some bug reporting and triage for his adopted
153@@ -50,8 +36,7 @@
154 chooses to search for all bugs that need to be forwarded upstream.
155 He sees one match.
156
157- >>> browser.open('http://bugs.launchpad.dev/alsa-utils/')
158- >>> browser.getLink('Advanced search').click()
159+ >>> browser.open('http://bugs.launchpad.dev/alsa-utils/+bugs?advanced=1')
160 >>> pending_bugwatch_label = (
161 ... 'Show bugs that need to be forwarded to an upstream '
162 ... 'bug tracker')
163@@ -61,23 +46,3 @@
164 >>> print extract_text(bug_listing)
165 Summary Importance Status
166 ...Test Bug 1 Undecided New
167-
168-
169-== Common searches on a product's bug page (part 2) ==
170-
171-No Privileges Person returns to the alsa-utils front page on Launchpad.
172-He wants to link bugs to to the upstream bug tracker.
173-
174- >>> user_browser.open('http://bugs.launchpad.dev/alsa-utils/')
175- >>> user_browser.title
176- 'Bugs in ALSA utilities'
177-
178- >>> pending_watches_link = user_browser.getLink(
179- ... 'Bugs need forwarding upstream')
180- >>> pending_watches_link.click()
181-
182- >>> bug_listing = find_tag_by_id(user_browser.contents, 'buglisting')
183- >>> print extract_text(bug_listing)
184- Summary Importance Status
185- ...Test Bug 1 Undecided New
186-
187
188=== modified file 'lib/lp/bugs/stories/initial-bug-contacts/10-set-upstream-bugcontact.txt'
189--- lib/lp/bugs/stories/initial-bug-contacts/10-set-upstream-bugcontact.txt 2009-11-12 15:33:27 +0000
190+++ lib/lp/bugs/stories/initial-bug-contacts/10-set-upstream-bugcontact.txt 2010-01-19 16:41:16 +0000
191@@ -110,11 +110,37 @@
192 >>> sample_browser.url
193 'http://launchpad.dev/testy'
194
195+By default, a newly created project doesn't use Launchpad for bug
196+tracking, and none of the bug lists or edit controls will be
197+available.
198+
199+ >>> sample_browser.getLink('Bugs').click()
200+ >>> uses_malone_p = find_tag_by_id(sample_browser.contents, 'no-malone')
201+ >>> print extract_text(uses_malone_p)
202+ A product for testing things does not use Launchpad for bug tracking.
203+
204+We can change the settings to use Launchpad for bug tracking.
205+
206+ >>> sample_browser.getLink(
207+ ... 'Enable bug tracking.').click()
208+ >>> print sample_browser.title
209+ Change A product for testing things's details : Bugs : Test Product
210+ >>> sample_browser.getControl('In Launchpad').click()
211+ >>> sample_browser.getControl('Change').click()
212+
213+Now, information about bug tracking (bug supervisor, security contact)
214+and their edit controls are available on the page.
215+
216+ >>> bug_supervisor = find_tag_by_id(
217+ ... sample_browser.contents, 'bug-supervisor')
218+ >>> print extract_text(bug_supervisor)
219+ Bug supervisor:
220+ None set
221+
222 Sample Person is a member of "Warty Security Team". However, he should not be
223 able to set Warty Security Team as a bug supervisor for Test Project as he's
224 not an admin of that team.
225
226- >>> sample_browser.getLink('Bugs').click()
227 >>> sample_browser.getLink('Change bug supervisor').click()
228 >>> sample_browser.url
229 'http://bugs.launchpad.dev/testy/+bugsupervisor'
230
231=== modified file 'lib/lp/bugs/templates/bugtarget-bugs.pt'
232--- lib/lp/bugs/templates/bugtarget-bugs.pt 2009-12-19 19:12:34 +0000
233+++ lib/lp/bugs/templates/bugtarget-bugs.pt 2010-01-19 16:41:16 +0000
234@@ -14,7 +14,7 @@
235 <script type="text/javascript" src="/+icing/PlotKit_Packed.js"></script>
236 </metal:block>
237 <body>
238- <tal:side metal:fill-slot="side">
239+ <tal:side metal:fill-slot="side" condition="view/uses_launchpad_bugtracker">
240 <div id="involvement" class="portlet involvement">
241 <ul>
242 <li style="border: none">
243@@ -45,94 +45,114 @@
244 tal:define="search_url string:+bugs;
245 advanced_search_url string:+bugs?advanced=1">
246
247- <div class="portlet" style="float: right; border: none">
248- <ul>
249- <li id="bugtracker" tal:condition="not: view/uses_launchpad_bugtracker">
250- <strong>Bug tracker:</strong><br />
251- <span style="margin-left: 1em">
252- <tal:bugtracker replace="structure view/bugtracker" />
253- </span>
254- </li>
255- <li tal:define="bug_supervisor context/bug_supervisor">
256- Bug supervisor:<br />
257- <span style="margin-left: 1em">
258- <tal:none condition="not:bug_supervisor">None set</tal:none>
259- <a tal:condition="bug_supervisor"
260- tal:replace="structure bug_supervisor/fmt:link">Bob Johnson</a>
261- <tal:edit-bug-supervisor
262- condition="context/menu:bugs/bugsupervisor|nothing">
263- <a tal:define="link context/menu:bugs/bugsupervisor"
264- tal:condition="link/enabled"
265- tal:attributes="href link/url; title link/text">
266- <img tal:attributes="alt link/text" src="/@@/edit" />
267- </a>
268- </tal:edit-bug-supervisor>
269- </span>
270- </li>
271- <li tal:define="securitycontact context/security_contact">
272- Security contact:<br />
273- <span style="margin-left: 1em">
274- <tal:none condition="not:securitycontact">None set</tal:none>
275- <a tal:condition="securitycontact"
276- tal:replace="structure securitycontact/fmt:link">
277- Billy Anderson
278- </a>
279- <tal:edit-securitycontact
280- condition="context/menu:bugs/securitycontact|nothing">
281- <a tal:define="link context/menu:bugs/securitycontact"
282- tal:condition="link/enabled"
283- tal:attributes="href link/url; title link/text">
284- <img tal:attributes="alt link/text" src="/@@/edit" />
285+ <tal:uses_malone condition="view/uses_launchpad_bugtracker">
286+ <div class="portlet" style="float: right; border: none">
287+ <ul>
288+ <li id="bugtracker" tal:condition="not: view/uses_launchpad_bugtracker">
289+ <strong>Bug tracker:</strong><br />
290+ <span style="margin-left: 1em">
291+ <tal:bugtracker replace="structure view/bugtracker" />
292+ </span>
293+ </li>
294+ <li id="bug-supervisor"
295+ tal:define="bug_supervisor context/bug_supervisor">
296+ Bug supervisor:<br />
297+ <span style="margin-left: 1em">
298+ <tal:none condition="not:bug_supervisor">None set</tal:none>
299+ <a tal:condition="bug_supervisor"
300+ tal:replace="structure bug_supervisor/fmt:link">Bob Johnson</a>
301+ <tal:edit-bug-supervisor
302+ condition="context/menu:bugs/bugsupervisor|nothing">
303+ <a tal:define="link context/menu:bugs/bugsupervisor"
304+ tal:condition="link/enabled"
305+ tal:attributes="href link/url; title link/text">
306+ <img tal:attributes="alt link/text" src="/@@/edit" />
307+ </a>
308+ </tal:edit-bug-supervisor>
309+ </span>
310+ </li>
311+ <li id="bug-security"
312+ tal:define="securitycontact context/security_contact">
313+ Security contact:<br />
314+ <span style="margin-left: 1em">
315+ <tal:none condition="not:securitycontact">None set</tal:none>
316+ <a tal:condition="securitycontact"
317+ tal:replace="structure securitycontact/fmt:link">
318+ Billy Anderson
319 </a>
320- </tal:edit-securitycontact>
321- </span>
322- </li>
323- <li>
324- </li>
325- </ul>
326- </div>
327-
328- <div class="search-box">
329- <metal:search
330- use-macro="context/@@+bugtarget-macros-search/simple-search-form"
331- />
332- </div>
333- <script type="text/javascript"><!--
334- $('field.searchtext').focus();
335- --></script>
336-
337- <h2 style="margin-top: 1em">Hot bugs</h2>
338-
339- <table class="listing" id="hot-bugs">
340- <thead>
341- <tr>
342- <th colspan="3">Summary</th>
343- <th>Status</th>
344- <th>Importance</th>
345- <th>Last changed</th>
346- </tr>
347- </thead>
348- <tbody>
349- <tr tal:repeat="bugtask view/hot_bugtasks">
350- <td class="icon left">
351- <img alt="" src="/@@/bug" />
352- </td>
353- <td style="text-align: right">
354- #<span tal:replace="bugtask/bug/id" />
355- </td>
356- <td>
357- <a tal:attributes="href bugtask/fmt:url"
358- tal:content="bugtask/bug/title" />
359- </td>
360- <td tal:attributes="class string:status${bugtask/status/name}"
361- tal:content="bugtask/status/title" />
362- <td tal:attributes="
363- class string:importance${bugtask/importance/name}"
364- tal:content="bugtask/importance/title" />
365- <td tal:content="bugtask/bug/date_last_updated/fmt:displaydate" />
366- </tr>
367- </tbody>
368- </table>
369+ <tal:edit-securitycontact
370+ condition="context/menu:bugs/securitycontact|nothing">
371+ <a tal:define="link context/menu:bugs/securitycontact"
372+ tal:condition="link/enabled"
373+ tal:attributes="href link/url; title link/text">
374+ <img tal:attributes="alt link/text" src="/@@/edit" />
375+ </a>
376+ </tal:edit-securitycontact>
377+ </span>
378+ </li>
379+ <li>
380+ </li>
381+ </ul>
382+ </div>
383+
384+ <tal:has_hot_bugs condition="view/hot_bugtasks">
385+ <div class="search-box">
386+ <metal:search
387+ use-macro="context/@@+bugtarget-macros-search/simple-search-form"
388+ />
389+ </div>
390+ <script type="text/javascript"><!--
391+ $('field.searchtext').focus();
392+ --></script>
393+
394+ <h2 style="margin-top: 1em">Hot bugs</h2>
395+
396+ <table class="listing" id="hot-bugs">
397+ <thead>
398+ <tr>
399+ <th colspan="3">Summary</th>
400+ <th>Status</th>
401+ <th>Importance</th>
402+ <th>Last changed</th>
403+ </tr>
404+ </thead>
405+ <tbody>
406+ <tr tal:repeat="bugtask view/hot_bugtasks">
407+ <td class="icon left">
408+ <img alt="" src="/@@/bug" />
409+ </td>
410+ <td style="text-align: right">
411+ #<span tal:replace="bugtask/bug/id" />
412+ </td>
413+ <td>
414+ <a tal:attributes="href bugtask/fmt:url"
415+ tal:content="bugtask/bug/title" />
416+ </td>
417+ <td tal:attributes="class string:status${bugtask/status/name}"
418+ tal:content="bugtask/status/title" />
419+ <td tal:attributes="
420+ class string:importance${bugtask/importance/name}"
421+ tal:content="bugtask/importance/title" />
422+ <td tal:content="bugtask/bug/date_last_updated/fmt:displaydate" />
423+ </tr>
424+ </tbody>
425+ </table>
426+ </tal:has_hot_bugs>
427+
428+ <tal:no_hot_bugs condition="not: view/hot_bugtasks">
429+ <p id="no-bugs-filed"><strong>There are currently no bugs filed against
430+ <tal:project_title replace="context/title" />.</strong></p>
431+
432+ <p id="no-bugs-report"><a href="+filebug">Report a bug.</a></p>
433+ </tal:no_hot_bugs>
434+ </tal:uses_malone>
435+
436+ <tal:not_uses_malone condition="not: view/uses_launchpad_bugtracker">
437+ <p id="no-malone"><strong><tal:project_title replace="context/title" /> does not use Launchpad for
438+ bug tracking.</strong></p>
439+
440+ <p id="no-malone-edit"><a href="+edit">Enable bug tracking.</a></p>
441+ </tal:not_uses_malone>
442
443 </div><!-- main -->
444 </body>