Merge lp:~stevenk/launchpad/hide-search-for-unofficial into lp:launchpad

Proposed by Steve Kowalik
Status: Work in progress
Proposed branch: lp:~stevenk/launchpad/hide-search-for-unofficial
Merge into: lp:launchpad
Diff against target: 122 lines (+23/-28)
4 files modified
lib/lp/bugs/browser/tests/test_buglisting.py (+11/-0)
lib/lp/bugs/templates/buglisting-default.pt (+3/-1)
lib/lp/bugs/templates/bugtarget-macros-search.pt (+4/-19)
lib/lp/registry/model/product.py (+5/-8)
To merge this branch: bzr merge lp:~stevenk/launchpad/hide-search-for-unofficial
Reviewer Review Type Date Requested Status
Ian Booth (community) Approve
Review via email: mp+122993@code.launchpad.net

Commit message

Do not show the search form for ! ServiceUsage.LAUNCHPAD on Product:+bugs. Destroy buglisting conditionals in bugtarget-macros-search.

Description of the change

Do not show the search form for ! ServiceUsage.LAUNCHPAD on Product:+bugs. The block was contained in a not ServiceUsage.UNKNOWN block, which means that products that had an bugtracker set (which makes them ServiceUsage.EXTERNAL) would have the search form displayed.

Rip out the buglisting conditionals out of bugtarget-macros-search to save some lines, and start the death mark to the death of buglisting feature flags.

Drive-by some fixes to model/product.

To post a comment you must log in.
15914. By Steve Kowalik

Make use of should_show_bug_information, and switch action back to TAL.

Revision history for this message
Ian Booth (wallyworld) wrote :

Looks ok, but tests will tell for sure.

review: Approve

Unmerged revisions

15914. By Steve Kowalik

Make use of should_show_bug_information, and switch action back to TAL.

15913. By Steve Kowalik

Do not show the search form for ServiceUsage.EXTERNAL. Rip out the buglisting conditionals out of bugtarget-macros-search, and drive-by some fixes to model/product.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/browser/tests/test_buglisting.py'
2--- lib/lp/bugs/browser/tests/test_buglisting.py 2012-04-17 07:54:24 +0000
3+++ lib/lp/bugs/browser/tests/test_buglisting.py 2012-09-06 05:34:22 +0000
4@@ -351,6 +351,17 @@
5 view = create_initialized_view(product, '+bugs')
6 self.assertThat(view.render(), HTMLContains(search_form_matches))
7
8+ def test_search_is_hidden_for_serviceusage_external(self):
9+ # The search form should not be shown for ServiceUsage.EXTERNAL.
10+ product = self.factory.makeProduct(official_malone=False)
11+ with person_logged_in(product.owner):
12+ product.bugtracker = self.factory.makeBugTracker()
13+ flags = {u"bugs.dynamic_bug_listings.enabled": u"true"}
14+ with FeatureFixture(flags):
15+ view = create_initialized_view(product, '+bugs')
16+ html = view.render()
17+ self.assertNotIn('primary search dynamic_bug_listing', html)
18+
19
20 class BugTargetTestCase(TestCaseWithFactory):
21 """Test helpers for setting up `IBugTarget` tests."""
22
23=== modified file 'lib/lp/bugs/templates/buglisting-default.pt'
24--- lib/lp/bugs/templates/buglisting-default.pt 2012-08-21 00:34:02 +0000
25+++ lib/lp/bugs/templates/buglisting-default.pt 2012-09-06 05:34:22 +0000
26@@ -32,7 +32,7 @@
27
28 <div metal:fill-slot="main">
29 <div
30- tal:condition="not: view/bug_tracking_usage/enumvalue:LAUNCHPAD"
31+ tal:condition="not: view/should_show_bug_information"
32 class="top-portlet">
33 <p id="no-malone"
34 tal:condition="view/bug_tracking_usage/enumvalue:UNKNOWN">
35@@ -104,6 +104,7 @@
36 </tal:has_products>
37 </tal:is_project_group>
38
39+ <div tal:condition="view/should_show_bug_information">
40 <tal:do_not_show_advanced_form
41 condition="not: view/shouldShowAdvancedForm">
42 <div tal:define="batch_navigator view/search">
43@@ -116,6 +117,7 @@
44 <metal:advanced_form
45 use-macro="context/@@+bugtask-macros-tableview/advanced_search_form" />
46 </tal:show_advanced_form>
47+ </div>
48
49 <div class="yui-u">
50 <div id="structural-subscription-content-box"></div>
51
52=== modified file 'lib/lp/bugs/templates/bugtarget-macros-search.pt'
53--- lib/lp/bugs/templates/bugtarget-macros-search.pt 2011-10-19 12:44:55 +0000
54+++ lib/lp/bugs/templates/bugtarget-macros-search.pt 2012-09-06 05:34:22 +0000
55@@ -78,29 +78,14 @@
56 </metal:block>
57
58 <metal:block define-macro="simple-search-form">
59-<div id="bugs-search-form"
60- tal:attributes="
61- class python:
62- 'dynamic_bug_listing' if view.dynamic_bug_listing_enabled
63- else None;
64- action search_url|string:">
65- <form method="get" name="search" class="primary search"
66- tal:attributes="
67- class python:
68- 'primary search dynamic_bug_listing'
69- if view.dynamic_bug_listing_enabled
70- else 'primary search';
71- action search_url|string:">
72- <h3 tal:condition="view/dynamic_bug_listing_enabled"
73- tal:content="view/search_macro_title">
74+<div id="bugs-search-form" tal:attribute="action search_url|string:">
75+ <form method="get" name="search" class="dynamic_bug_listing primary search"
76+ tal:attribute="action search_url|string:">
77+ <h3 tal:content="view/search_macro_title">
78 Search bugs in Ubuntu
79 </h3>
80 <p>
81 <tal:searchbox replace="structure view/widgets/searchtext" />
82- <tal:without_dynamic_bug_listing
83- condition="not: view/dynamic_bug_listing_enabled">
84- <metal:widget use-macro="context/@@+bugtarget-macros-search/sortwidget" />
85- </tal:without_dynamic_bug_listing>
86 <input type="submit" name="search" value="Search" />
87 <tal:widget replace="structure view/widgets/status/hidden" />
88 <tal:widget replace="structure view/widgets/importance/hidden" />
89
90=== modified file 'lib/lp/registry/model/product.py'
91--- lib/lp/registry/model/product.py 2012-09-03 11:22:25 +0000
92+++ lib/lp/registry/model/product.py 2012-09-06 05:34:22 +0000
93@@ -407,8 +407,6 @@
94
95 @property
96 def official_codehosting(self):
97- # XXX Need to remove official_codehosting column from Product
98- # table.
99 return self.development_focus.branch is not None
100
101 @property
102@@ -456,15 +454,14 @@
103 @property
104 def uses_launchpad(self):
105 """Does this distribution actually use Launchpad?"""
106- return ServiceUsage.LAUNCHPAD in (self.answers_usage,
107- self.blueprints_usage,
108- self.translations_usage,
109- self.codehosting_usage,
110- self.bug_tracking_usage)
111+ return ServiceUsage.LAUNCHPAD in (
112+ self.answers_usage, self.blueprints_usage,
113+ self.translations_usage, self.codehosting_usage,
114+ self.bug_tracking_usage)
115
116 def _getMilestoneCondition(self):
117 """See `HasMilestonesMixin`."""
118- return (Milestone.product == self)
119+ return Milestone.product == self
120
121 enable_bug_expiration = BoolCol(dbName='enable_bug_expiration',
122 notNull=True, default=False)