Merge lp:~maxiberta/launchpad/bug-feed-fix-private-team into lp:launchpad

Proposed by Maximiliano Bertacchini on 2016-07-27
Status: Merged
Merged at revision: 18167
Proposed branch: lp:~maxiberta/launchpad/bug-feed-fix-private-team
Merge into: lp:launchpad
Diff against target: 110 lines (+78/-1)
3 files modified
lib/lp/bugs/feed/templates/bug.pt (+4/-1)
lib/lp/bugs/stories/feeds/xx-bug-atom.txt (+47/-0)
lib/lp/bugs/stories/feeds/xx-bug-html.txt (+27/-0)
To merge this branch: bzr merge lp:~maxiberta/launchpad/bug-feed-fix-private-team
Reviewer Review Type Date Requested Status
Colin Watson 2016-07-27 Approve on 2016-07-28
Review via email: mp+301337@code.launchpad.net

Commit message

Prevent rendering of private team names in bugs feed.

Description of the change

Prevent rendering of private team names in bugs feed.

To post a comment you must log in.
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/feed/templates/bug.pt'
2--- lib/lp/bugs/feed/templates/bug.pt 2009-07-17 17:59:07 +0000
3+++ lib/lp/bugs/feed/templates/bug.pt 2016-07-27 22:49:46 +0000
4@@ -31,7 +31,10 @@
5 </tal:milestone>
6 <td tal:content="bugtask/status/title">Won't Fix</td>
7 <td tal:content="bugtask/importance/title">Unknown</td>
8- <td tal:content="bugtask/assignee/displayname|string:-">Person</td>
9+ <td tal:define="assignee bugtask/assignee"
10+ tal:content="python:assignee and not assignee.private and assignee.displayname or '-'">
11+ Person
12+ </td>
13 <td>
14 <a tal:condition="bugtask/bugwatch"
15 tal:attributes="href bugtask/bugwatch/url"
16
17=== modified file 'lib/lp/bugs/stories/feeds/xx-bug-atom.txt'
18--- lib/lp/bugs/stories/feeds/xx-bug-atom.txt 2012-12-12 04:59:52 +0000
19+++ lib/lp/bugs/stories/feeds/xx-bug-atom.txt 2016-07-27 22:49:46 +0000
20@@ -173,6 +173,53 @@
21 >>> assert check_entries_order(entries), (
22 ... "Published dates are not sorted.")
23
24+=== Private teams as assignees ===
25+
26+Create a private team and assign an ubuntu distro bug to that team.
27+
28+ >>> from zope.component import getUtility
29+ >>> from lp.bugs.interfaces.bug import IBugSet
30+ >>> from lp.registry.interfaces.person import PersonVisibility
31+
32+ >>> login('foo.bar@canonical.com')
33+ >>> priv_team = factory.makeTeam(visibility=PersonVisibility.PRIVATE)
34+ >>> bug = getUtility(IBugSet).get(1)
35+ >>> print bug.title
36+ Firefox does not support SVG
37+ >>> print len(bug.bugtasks)
38+ 3
39+ >>> from zope.security.proxy import removeSecurityProxy
40+ >>> bugtask = removeSecurityProxy(bug.bugtasks[1])
41+ >>> print bugtask.distribution
42+ <Distribution 'Ubuntu' (ubuntu)>
43+ >>> bugtask.assignee = priv_team
44+ >>> logout()
45+
46+Get the ubuntu/latest-bugs feed.
47+
48+ >>> browser.open('http://feeds.launchpad.dev/ubuntu/latest-bugs.atom')
49+ >>> validate_feed(browser.contents,
50+ ... browser.headers['content-type'], browser.url)
51+ No Errors
52+
53+ >>> entries = parse_entries(browser.contents)
54+ >>> print len(entries)
55+ 4
56+
57+The bug should be included in the feed.
58+
59+ >>> entry = entries[3]
60+ >>> print extract_text(entry.title)
61+ [1] Firefox does not support SVG
62+
63+Private teams should show as '-'.
64+
65+ >>> entry_content = BSS(
66+ ... entry.find('content').text,
67+ ... convertEntities=BSS.HTML_ENTITIES)
68+ >>> soup = BSS(entry_content.text)
69+ >>> print [tr.findAll('td')[4].text for tr in soup.findAll('tr')[1:4]]
70+ [u'Mark Shuttleworth', u'-', u'-']
71
72 == Latest bugs for a source package ==
73
74
75=== modified file 'lib/lp/bugs/stories/feeds/xx-bug-html.txt'
76--- lib/lp/bugs/stories/feeds/xx-bug-html.txt 2011-12-29 05:29:36 +0000
77+++ lib/lp/bugs/stories/feeds/xx-bug-html.txt 2016-07-27 22:49:46 +0000
78@@ -92,6 +92,33 @@
79 >>> get_bug_numbers(entries)
80 [15, 15, 9, 9, 5, 5, 5, 4, 1, 1, 1]
81
82+=== Private teams as assignees ===
83+
84+Create a private team and assign a mozilla bug to that team.
85+
86+ >>> from zope.component import getUtility
87+ >>> from lp.bugs.interfaces.bug import IBugSet
88+ >>> from lp.registry.interfaces.person import PersonVisibility
89+
90+ >>> login('foo.bar@canonical.com')
91+ >>> priv_team = factory.makeTeam(visibility=PersonVisibility.PRIVATE)
92+ >>> bug = getUtility(IBugSet).get(1)
93+ >>> print bug.title
94+ Firefox does not support SVG
95+ >>> print len(bug.bugtasks)
96+ 3
97+ >>> from zope.security.proxy import removeSecurityProxy
98+ >>> bugtask = removeSecurityProxy(bug.bugtasks[1])
99+ >>> bugtask.assignee = priv_team
100+ >>> logout()
101+
102+Get the mozilla/latest-bugs feed. The previous bug should be included.
103+
104+ >>> browser.open('http://feeds.launchpad.dev/mozilla/latest-bugs.html?'
105+ ... 'show_column=bugtargetdisplayname')
106+ >>> entries = parse_entries(browser.contents)
107+ >>> get_bug_numbers(entries)
108+ [15, 15, 9, 9, 5, 5, 5, 4, 1, 1, 1]
109
110 == Latest bugs for a person ==
111