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

Proposed by Maximiliano Bertacchini
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 (community) Approve
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.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/bugs/feed/templates/bug.pt'
--- lib/lp/bugs/feed/templates/bug.pt 2009-07-17 17:59:07 +0000
+++ lib/lp/bugs/feed/templates/bug.pt 2016-07-27 22:49:46 +0000
@@ -31,7 +31,10 @@
31 </tal:milestone>31 </tal:milestone>
32 <td tal:content="bugtask/status/title">Won't Fix</td>32 <td tal:content="bugtask/status/title">Won't Fix</td>
33 <td tal:content="bugtask/importance/title">Unknown</td>33 <td tal:content="bugtask/importance/title">Unknown</td>
34 <td tal:content="bugtask/assignee/displayname|string:-">Person</td>34 <td tal:define="assignee bugtask/assignee"
35 tal:content="python:assignee and not assignee.private and assignee.displayname or '-'">
36 Person
37 </td>
35 <td>38 <td>
36 <a tal:condition="bugtask/bugwatch"39 <a tal:condition="bugtask/bugwatch"
37 tal:attributes="href bugtask/bugwatch/url"40 tal:attributes="href bugtask/bugwatch/url"
3841
=== modified file 'lib/lp/bugs/stories/feeds/xx-bug-atom.txt'
--- lib/lp/bugs/stories/feeds/xx-bug-atom.txt 2012-12-12 04:59:52 +0000
+++ lib/lp/bugs/stories/feeds/xx-bug-atom.txt 2016-07-27 22:49:46 +0000
@@ -173,6 +173,53 @@
173 >>> assert check_entries_order(entries), (173 >>> assert check_entries_order(entries), (
174 ... "Published dates are not sorted.")174 ... "Published dates are not sorted.")
175175
176=== Private teams as assignees ===
177
178Create a private team and assign an ubuntu distro bug to that team.
179
180 >>> from zope.component import getUtility
181 >>> from lp.bugs.interfaces.bug import IBugSet
182 >>> from lp.registry.interfaces.person import PersonVisibility
183
184 >>> login('foo.bar@canonical.com')
185 >>> priv_team = factory.makeTeam(visibility=PersonVisibility.PRIVATE)
186 >>> bug = getUtility(IBugSet).get(1)
187 >>> print bug.title
188 Firefox does not support SVG
189 >>> print len(bug.bugtasks)
190 3
191 >>> from zope.security.proxy import removeSecurityProxy
192 >>> bugtask = removeSecurityProxy(bug.bugtasks[1])
193 >>> print bugtask.distribution
194 <Distribution 'Ubuntu' (ubuntu)>
195 >>> bugtask.assignee = priv_team
196 >>> logout()
197
198Get the ubuntu/latest-bugs feed.
199
200 >>> browser.open('http://feeds.launchpad.dev/ubuntu/latest-bugs.atom')
201 >>> validate_feed(browser.contents,
202 ... browser.headers['content-type'], browser.url)
203 No Errors
204
205 >>> entries = parse_entries(browser.contents)
206 >>> print len(entries)
207 4
208
209The bug should be included in the feed.
210
211 >>> entry = entries[3]
212 >>> print extract_text(entry.title)
213 [1] Firefox does not support SVG
214
215Private teams should show as '-'.
216
217 >>> entry_content = BSS(
218 ... entry.find('content').text,
219 ... convertEntities=BSS.HTML_ENTITIES)
220 >>> soup = BSS(entry_content.text)
221 >>> print [tr.findAll('td')[4].text for tr in soup.findAll('tr')[1:4]]
222 [u'Mark Shuttleworth', u'-', u'-']
176223
177== Latest bugs for a source package ==224== Latest bugs for a source package ==
178225
179226
=== modified file 'lib/lp/bugs/stories/feeds/xx-bug-html.txt'
--- lib/lp/bugs/stories/feeds/xx-bug-html.txt 2011-12-29 05:29:36 +0000
+++ lib/lp/bugs/stories/feeds/xx-bug-html.txt 2016-07-27 22:49:46 +0000
@@ -92,6 +92,33 @@
92 >>> get_bug_numbers(entries)92 >>> get_bug_numbers(entries)
93 [15, 15, 9, 9, 5, 5, 5, 4, 1, 1, 1]93 [15, 15, 9, 9, 5, 5, 5, 4, 1, 1, 1]
9494
95=== Private teams as assignees ===
96
97Create a private team and assign a mozilla bug to that team.
98
99 >>> from zope.component import getUtility
100 >>> from lp.bugs.interfaces.bug import IBugSet
101 >>> from lp.registry.interfaces.person import PersonVisibility
102
103 >>> login('foo.bar@canonical.com')
104 >>> priv_team = factory.makeTeam(visibility=PersonVisibility.PRIVATE)
105 >>> bug = getUtility(IBugSet).get(1)
106 >>> print bug.title
107 Firefox does not support SVG
108 >>> print len(bug.bugtasks)
109 3
110 >>> from zope.security.proxy import removeSecurityProxy
111 >>> bugtask = removeSecurityProxy(bug.bugtasks[1])
112 >>> bugtask.assignee = priv_team
113 >>> logout()
114
115Get the mozilla/latest-bugs feed. The previous bug should be included.
116
117 >>> browser.open('http://feeds.launchpad.dev/mozilla/latest-bugs.html?'
118 ... 'show_column=bugtargetdisplayname')
119 >>> entries = parse_entries(browser.contents)
120 >>> get_bug_numbers(entries)
121 [15, 15, 9, 9, 5, 5, 5, 4, 1, 1, 1]
95122
96== Latest bugs for a person ==123== Latest bugs for a person ==
97124