Merge lp:~stevenk/launchpad/hide-build-portlet-archive into lp:launchpad

Proposed by Steve Kowalik
Status: Merged
Approved by: William Grant
Approved revision: no longer in the source branch.
Merged at revision: 16520
Proposed branch: lp:~stevenk/launchpad/hide-build-portlet-archive
Merge into: lp:launchpad
Diff against target: 54 lines (+11/-4)
2 files modified
lib/lp/soyuz/templates/archive-macros.pt (+2/-1)
lib/lp/soyuz/tests/test_archive_subscriptions.py (+9/-3)
To merge this branch: bzr merge lp:~stevenk/launchpad/hide-build-portlet-archive
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+151864@code.launchpad.net

Commit message

Hide the Latest Updates portlet on Archive:+index if View isn't held -- subscribers to the archive shouldn't be shown build information.

Description of the change

Hide the Latest Updates portlet on Archive:+index if View isn't held -- subscribers to the archive shouldn't be shown build information, and if the portlet tries to drill down to show failures they will get a 403.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/soyuz/templates/archive-macros.pt'
2--- lib/lp/soyuz/templates/archive-macros.pt 2012-11-01 03:41:36 +0000
3+++ lib/lp/soyuz/templates/archive-macros.pt 2013-03-07 00:54:22 +0000
4@@ -318,7 +318,8 @@
5 Present the latest updates for a PPA in a portlet.
6 </tal:comment>
7
8- <tal:latest_updates define="updates view/latest_updates">
9+ <tal:latest_updates define="updates view/latest_updates"
10+ tal:condition="context/required:launchpad.View">
11 <div id="portlet-latest-updates" class="portlet">
12 <h2>Latest updates</h2>
13
14
15=== modified file 'lib/lp/soyuz/tests/test_archive_subscriptions.py'
16--- lib/lp/soyuz/tests/test_archive_subscriptions.py 2013-02-20 04:29:41 +0000
17+++ lib/lp/soyuz/tests/test_archive_subscriptions.py 2013-03-07 00:54:22 +0000
18@@ -6,10 +6,13 @@
19 from urlparse import urljoin
20
21 from zope.security.interfaces import Unauthorized
22+from zope.security.proxy import removeSecurityProxy
23
24+from lp.buildmaster.enums import BuildStatus
25 from lp.registry.interfaces.person import PersonVisibility
26 from lp.services.webapp.authorization import check_permission
27 from lp.services.webapp.publisher import canonical_url
28+from lp.soyuz.enums import PackagePublishingStatus
29 from lp.testing import (
30 BrowserTestCase,
31 login_person,
32@@ -136,7 +139,12 @@
33 with person_logged_in(self.owner):
34 self.archive = self.factory.makeArchive(
35 private=True, owner=self.private_team)
36- self.factory.makeSourcePackagePublishingHistory(archive=self.archive)
37+ spph = self.factory.makeSourcePackagePublishingHistory(
38+ archive=self.archive, status=PackagePublishingStatus.PUBLISHED)
39+ spr = removeSecurityProxy(spph).sourcepackagerelease
40+ self.factory.makeBinaryPackageBuild(
41+ source_package_release=spr, archive=self.archive,
42+ status=BuildStatus.FAILEDTOBUILD)
43 self.subscriber = self.factory.makePerson()
44
45 def test_traverse_view_private_team_archive_subscriber(self):
46@@ -150,8 +158,6 @@
47 browser.open(url)
48 content = find_tag_by_id(browser.contents, 'document')
49 self.assertIsNotNone(find_tag_by_id(content, 'ppa-install'))
50- self.assertIsNotNone(
51- find_tag_by_id(content, 'portlet-latest-updates'))
52
53 def test_unauthorized_subscriber_for_plus_packages(self):
54 with person_logged_in(self.owner):