Skip to content

Commit

Permalink
Merge pull request #5365 from hypothesis/deprecate-wildcard-feature-flag
Browse files Browse the repository at this point in the history
Deprecate wildcard_search_on_activity_pages feature flag
  • Loading branch information
Hannah Stepanek committed Oct 16, 2018
2 parents f895098 + a5026ce commit 020c2f8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 22 deletions.
6 changes: 1 addition & 5 deletions h/activity/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
AuthorityFilter,
TagsAggregation,
UsersAggregation,
UriFilter,
UriCombinedWildcardFilter)


Expand Down Expand Up @@ -169,10 +168,7 @@ def _execute_search(request, query, page_size):
search = Search(request, stats=request.stats)
search.append_modifier(AuthorityFilter(authority=request.default_authority))
search.append_modifier(TopLevelAnnotationsFilter())
if request.feature("wildcard_search_on_activity_pages"):
search.append_modifier(UriCombinedWildcardFilter(request=request))
else:
search.append_modifier(UriFilter(request=request))
search.append_modifier(UriCombinedWildcardFilter(request=request))
for agg in aggregations_for(query):
search.append_aggregation(agg)

Expand Down
2 changes: 1 addition & 1 deletion h/models/feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
'overlay_highlighter': "Use the new overlay highlighter?",
'api_render_user_info': "Return users' extended info in API responses?",
'client_display_names': "Render display names instead of user names in the client",
'wildcard_search_on_activity_pages': "Enable wildcard search via url facet on activity pages.",
}

# Once a feature has been fully deployed, we remove the flag from the codebase.
Expand All @@ -40,6 +39,7 @@
# 4. Finally, remove the feature from FEATURES_PENDING_REMOVAL.
#
FEATURES_PENDING_REMOVAL = {
'wildcard_search_on_activity_pages': "Enable wildcard search via url facet on activity pages.",
}


Expand Down
19 changes: 3 additions & 16 deletions tests/h/activity/query_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,24 +252,15 @@ def test_it_only_shows_annotations_from_default_authority(self,
AuthorityFilter.assert_called_once_with(pyramid_request.default_authority)
search.append_modifier.assert_any_call(AuthorityFilter.return_value)

@pytest.mark.parametrize('enable_flag', (True, False))
def test_it_recognizes_wildcards_in_uri_url(self,
pyramid_request,
search,
UriFilter,
UriCombinedWildcardFilter,
enable_flag):

pyramid_request.feature.flags['wildcard_search_on_activity_pages'] = enable_flag
UriCombinedWildcardFilter):

execute(pyramid_request, MultiDict(), self.PAGE_SIZE)

if enable_flag:
UriCombinedWildcardFilter.assert_called_once_with(pyramid_request)
search.append_modifier.assert_any_call(UriCombinedWildcardFilter.return_value)
else:
UriFilter.assert_called_once_with(pyramid_request)
search.append_modifier.assert_any_call(UriFilter.return_value)
UriCombinedWildcardFilter.assert_called_once_with(pyramid_request)
search.append_modifier.assert_any_call(UriCombinedWildcardFilter.return_value)

def test_it_adds_a_tags_aggregation_to_the_search_query(self,
pyramid_request,
Expand Down Expand Up @@ -640,10 +631,6 @@ def TagsAggregation(self, patch):
def AuthorityFilter(self, patch):
return patch('h.activity.query.AuthorityFilter')

@pytest.fixture
def UriFilter(self, patch):
return patch('h.activity.query.UriFilter')

@pytest.fixture
def UriCombinedWildcardFilter(self, patch):
return patch('h.activity.query.UriCombinedWildcardFilter')
Expand Down

0 comments on commit 020c2f8

Please sign in to comment.