← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Steve Kowalik has proposed merging lp:~stevenk/launchpad/hide-search-for-unofficial into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~stevenk/launchpad/hide-search-for-unofficial/+merge/122993

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.
-- 
https://code.launchpad.net/~stevenk/launchpad/hide-search-for-unofficial/+merge/122993
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/hide-search-for-unofficial into lp:launchpad.
=== modified file 'lib/lp/bugs/browser/tests/test_buglisting.py'
--- lib/lp/bugs/browser/tests/test_buglisting.py	2012-04-17 07:54:24 +0000
+++ lib/lp/bugs/browser/tests/test_buglisting.py	2012-09-06 02:55:23 +0000
@@ -351,6 +351,17 @@
             view = create_initialized_view(product, '+bugs')
             self.assertThat(view.render(), HTMLContains(search_form_matches))
 
+    def test_search_is_hidden_for_serviceusage_external(self):
+        # The search form should not be shown for ServiceUsage.EXTERNAL.
+        product = self.factory.makeProduct(official_malone=False)
+        with person_logged_in(product.owner):
+            product.bugtracker = self.factory.makeBugTracker()
+        flags = {u"bugs.dynamic_bug_listings.enabled": u"true"}
+        with FeatureFixture(flags):
+            view = create_initialized_view(product, '+bugs')
+            html = view.render()
+        self.assertNotIn('primary search dynamic_bug_listing', html)
+
 
 class BugTargetTestCase(TestCaseWithFactory):
     """Test helpers for setting up `IBugTarget` tests."""

=== modified file 'lib/lp/bugs/templates/buglisting-default.pt'
--- lib/lp/bugs/templates/buglisting-default.pt	2012-08-21 00:34:02 +0000
+++ lib/lp/bugs/templates/buglisting-default.pt	2012-09-06 02:55:23 +0000
@@ -104,6 +104,7 @@
         </tal:has_products>
       </tal:is_project_group>
 
+      <div tal:condition="view/bug_tracking_usage/enumvalue:LAUNCHPAD">
         <tal:do_not_show_advanced_form
           condition="not: view/shouldShowAdvancedForm">
           <div tal:define="batch_navigator view/search">
@@ -116,6 +117,7 @@
           <metal:advanced_form
              use-macro="context/@@+bugtask-macros-tableview/advanced_search_form" />
         </tal:show_advanced_form>
+      </div>
 
       <div class="yui-u">
         <div id="structural-subscription-content-box"></div>

=== modified file 'lib/lp/bugs/templates/bugtarget-macros-search.pt'
--- lib/lp/bugs/templates/bugtarget-macros-search.pt	2011-10-19 12:44:55 +0000
+++ lib/lp/bugs/templates/bugtarget-macros-search.pt	2012-09-06 02:55:23 +0000
@@ -78,29 +78,14 @@
 </metal:block>
 
 <metal:block define-macro="simple-search-form">
-<div id="bugs-search-form"
-     tal:attributes="
-         class python:
-             'dynamic_bug_listing' if view.dynamic_bug_listing_enabled
-                 else None;
-            action search_url|string:">
-  <form method="get" name="search" class="primary search"
-        tal:attributes="
-            class python:
-                'primary search dynamic_bug_listing'
-                    if view.dynamic_bug_listing_enabled
-                    else 'primary search';
-            action search_url|string:">
-    <h3 tal:condition="view/dynamic_bug_listing_enabled"
-        tal:content="view/search_macro_title">
+<div id="bugs-search-form" action="search_url">
+    <form method="get" name="search" class="dynamic_bug_listing primary search"
+        action="search_url">
+    <h3 tal:content="view/search_macro_title">
       Search bugs in Ubuntu
     </h3>
     <p>
     <tal:searchbox replace="structure view/widgets/searchtext" />
-    <tal:without_dynamic_bug_listing
-        condition="not: view/dynamic_bug_listing_enabled">
-        <metal:widget use-macro="context/@@+bugtarget-macros-search/sortwidget" />
-    </tal:without_dynamic_bug_listing>
     <input type="submit" name="search" value="Search" />
     <tal:widget replace="structure view/widgets/status/hidden" />
     <tal:widget replace="structure view/widgets/importance/hidden" />

=== modified file 'lib/lp/registry/model/product.py'
--- lib/lp/registry/model/product.py	2012-09-03 11:22:25 +0000
+++ lib/lp/registry/model/product.py	2012-09-06 02:55:23 +0000
@@ -407,8 +407,6 @@
 
     @property
     def official_codehosting(self):
-        # XXX Need to remove official_codehosting column from Product
-        # table.
         return self.development_focus.branch is not None
 
     @property
@@ -456,15 +454,14 @@
     @property
     def uses_launchpad(self):
         """Does this distribution actually use Launchpad?"""
-        return ServiceUsage.LAUNCHPAD in (self.answers_usage,
-                                          self.blueprints_usage,
-                                          self.translations_usage,
-                                          self.codehosting_usage,
-                                          self.bug_tracking_usage)
+        return ServiceUsage.LAUNCHPAD in (
+            self.answers_usage, self.blueprints_usage,
+            self.translations_usage, self.codehosting_usage,
+            self.bug_tracking_usage)
 
     def _getMilestoneCondition(self):
         """See `HasMilestonesMixin`."""
-        return (Milestone.product == self)
+        return Milestone.product == self
 
     enable_bug_expiration = BoolCol(dbName='enable_bug_expiration',
         notNull=True, default=False)


Follow ups