Maximiliano Bertacchini has proposed merging 
lp:~maxiberta/launchpad/bug-feed-fix-private-team into lp:launchpad.

Commit message:
Prevent rendering of private team names in bugs feed.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1592186 in Launchpad itself: 
"feeds.launchpad.net/ubuntu/latest-bugs.atom choked"
  https://bugs.launchpad.net/launchpad/+bug/1592186

For more details, see:
https://code.launchpad.net/~maxiberta/launchpad/bug-feed-fix-private-team/+merge/301337

Prevent rendering of private team names in bugs feed.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
lp:~maxiberta/launchpad/bug-feed-fix-private-team into lp:launchpad.
=== 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 @@
       </tal:milestone>
       <td tal:content="bugtask/status/title">Won't Fix</td>
       <td tal:content="bugtask/importance/title">Unknown</td>
-      <td tal:content="bugtask/assignee/displayname|string:-">Person</td>
+      <td tal:define="assignee bugtask/assignee"
+          tal:content="python:assignee and not assignee.private and assignee.displayname or '-'">
+        Person
+      </td>
       <td>
         <a tal:condition="bugtask/bugwatch"
             tal:attributes="href bugtask/bugwatch/url"

=== 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 @@
     >>> assert check_entries_order(entries), (
     ...     "Published dates are not sorted.")
 
+=== Private teams as assignees ===
+
+Create a private team and assign an ubuntu distro bug to that team.
+
+    >>> from zope.component import getUtility
+    >>> from lp.bugs.interfaces.bug import IBugSet
+    >>> from lp.registry.interfaces.person import PersonVisibility
+
+    >>> login('foo....@canonical.com')
+    >>> priv_team = factory.makeTeam(visibility=PersonVisibility.PRIVATE)
+    >>> bug = getUtility(IBugSet).get(1)
+    >>> print bug.title
+    Firefox does not support SVG
+    >>> print len(bug.bugtasks)
+    3
+    >>> from zope.security.proxy import removeSecurityProxy
+    >>> bugtask = removeSecurityProxy(bug.bugtasks[1])
+    >>> print bugtask.distribution
+    <Distribution 'Ubuntu' (ubuntu)>
+    >>> bugtask.assignee = priv_team
+    >>> logout()
+
+Get the ubuntu/latest-bugs feed.
+
+    >>> browser.open('http://feeds.launchpad.dev/ubuntu/latest-bugs.atom')
+    >>> validate_feed(browser.contents,
+    ...              browser.headers['content-type'], browser.url)
+    No Errors
+
+    >>> entries = parse_entries(browser.contents)
+    >>> print len(entries)
+    4
+
+The bug should be included in the feed.
+
+    >>> entry = entries[3]
+    >>> print extract_text(entry.title)
+    [1] Firefox does not support SVG
+
+Private teams should show as '-'.
+
+    >>> entry_content = BSS(
+    ...     entry.find('content').text,
+    ...     convertEntities=BSS.HTML_ENTITIES)
+    >>> soup = BSS(entry_content.text)
+    >>> print [tr.findAll('td')[4].text for tr in soup.findAll('tr')[1:4]]
+    [u'Mark Shuttleworth', u'-', u'-']
 
 == Latest bugs for a source package ==
 

=== 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 @@
     >>> get_bug_numbers(entries)
     [15, 15, 9, 9, 5, 5, 5, 4, 1, 1, 1]
 
+=== Private teams as assignees ===
+
+Create a private team and assign a mozilla bug to that team.
+
+    >>> from zope.component import getUtility
+    >>> from lp.bugs.interfaces.bug import IBugSet
+    >>> from lp.registry.interfaces.person import PersonVisibility
+
+    >>> login('foo....@canonical.com')
+    >>> priv_team = factory.makeTeam(visibility=PersonVisibility.PRIVATE)
+    >>> bug = getUtility(IBugSet).get(1)
+    >>> print bug.title
+    Firefox does not support SVG
+    >>> print len(bug.bugtasks)
+    3
+    >>> from zope.security.proxy import removeSecurityProxy
+    >>> bugtask = removeSecurityProxy(bug.bugtasks[1])
+    >>> bugtask.assignee = priv_team
+    >>> logout()
+
+Get the mozilla/latest-bugs feed. The previous bug should be included.
+
+    >>> browser.open('http://feeds.launchpad.dev/mozilla/latest-bugs.html?'
+    ...              'show_column=bugtargetdisplayname')
+    >>> entries = parse_entries(browser.contents)
+    >>> get_bug_numbers(entries)
+    [15, 15, 9, 9, 5, 5, 5, 4, 1, 1, 1]
 
 == Latest bugs for a person ==
 

_______________________________________________
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to     : launchpad-reviewers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help   : https://help.launchpad.net/ListHelp

Reply via email to