Commit 66762b6a authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch '244277-remove-ff-recent-items-search' into 'master'

Enable recent items search by default removing FF

Closes #244277

See merge request gitlab-org/gitlab!42302
parents 75c5c9ef f43e0e14
---
title: Autocomplete recently viewed issues in the global search bar
merge_request: 42302
author:
type: added
---
name: recent_items_search
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40669
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/244277
group: group::global search
type: development
default_enabled: false
\ No newline at end of file
......@@ -170,6 +170,7 @@ You can also type in this search bar to see autocomplete suggestions for:
- Various help pages (try and type **API help**)
- Project feature pages (try and type **milestones**)
- Various settings pages (try and type **user settings**)
- Recently viewed issues (try and type some word from the title of a recently viewed issue)
## To-Do List
......
......@@ -13,8 +13,6 @@ module Gitlab
end
def log_view(issue)
return unless recent_items_enabled?
with_redis do |redis|
redis.zadd(key, Time.now.to_f, issue.id)
redis.expire(key, @expires_after)
......@@ -29,8 +27,6 @@ module Gitlab
end
def search(term)
return Issue.none unless recent_items_enabled?
ids = with_redis do |redis|
redis.zrevrange(key, 0, @items_limit - 1)
end.map(&:to_i)
......@@ -51,10 +47,6 @@ module Gitlab
def type
Issue
end
def recent_items_enabled?
Feature.enabled?(:recent_items_search, @user)
end
end
end
end
......@@ -8,10 +8,6 @@ RSpec.describe ::Gitlab::Search::RecentIssues, :clean_gitlab_redis_shared_state
let(:recent_issues) { described_class.new(user: user, items_limit: 5) }
let(:project) { create(:project, :public) }
before do
stub_feature_flags(recent_items_search: true)
end
describe '#log_viewing' do
it 'adds the item to the recent items' do
recent_issues.log_view(issue)
......@@ -51,24 +47,6 @@ RSpec.describe ::Gitlab::Search::RecentIssues, :clean_gitlab_redis_shared_state
expect(results).to eq([issue])
end
context 'when recent_items_search feature flag is disabled' do
before do
stub_feature_flags(recent_items_search: false)
end
it 'does not store anything' do
recent_issues.log_view(issue)
# Re-enable before searching to prove that the `log_view` call did
# not persist it
stub_feature_flags(recent_items_search: true)
results = recent_issues.search('hello')
expect(results).to be_empty
end
end
end
describe '#search' do
......@@ -105,19 +83,5 @@ RSpec.describe ::Gitlab::Search::RecentIssues, :clean_gitlab_redis_shared_state
expect(recent_issues.search('matching')).not_to include(private_issue)
end
context 'when recent_items_search feature flag is disabled' do
it 'does not return anything' do
recent_issues.log_view(issue)
# Disable after persisting to prove that the `search` is not searching
# anything
stub_feature_flags(recent_items_search: false)
results = recent_issues.search('hello')
expect(results).to be_empty
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment