Commit b5f55407 authored by Angelo Gulina's avatar Angelo Gulina Committed by Stan Hu

Add feature flags search shortcut when feature enabled

- makes the navigation to Feature Flags more convenient
- makes the Feature Flags sub nav element more findable
parent 5e9a9ff5
...@@ -28,6 +28,13 @@ module EE ...@@ -28,6 +28,13 @@ module EE
end end
end end
override :project_autocomplete
def project_autocomplete
return super unless @project && @project.feature_available?(:feature_flags)
super + [{ category: "In this project", label: _("Feature Flags"), url: project_feature_flags_path(@project) }]
end
# This is a special case for snippet searches in .com. # This is a special case for snippet searches in .com.
# The scope used to gather the snippets is too wide and # The scope used to gather the snippets is too wide and
# we have to process a lot of them, what leads to time outs. # we have to process a lot of them, what leads to time outs.
......
---
title: Add Feature Flags Search Box shortcut
merge_request: 40578
author:
type: changed
...@@ -51,6 +51,31 @@ RSpec.describe SearchHelper do ...@@ -51,6 +51,31 @@ RSpec.describe SearchHelper do
end end
end end
describe '#project_autocomplete' do
let(:user) { create(:user) }
before do
@project = create(:project, :repository)
allow(self).to receive(:current_user).and_return(user)
end
context 'with a licensed user' do
it "does not include feature flags" do
expect(project_autocomplete.find { |i| i[:label] == 'Feature Flags'} ).to be_nil
end
end
context 'with a licensed user' do
before do
stub_licensed_features(feature_flags: true)
end
it "does include feature flags" do
expect(project_autocomplete.find { |i| i[:label] == 'Feature Flags' }).to be_present
end
end
end
describe '#search_entries_info_template' do describe '#search_entries_info_template' do
let(:com_value) { true } let(:com_value) { true }
let(:flag_enabled) { true } let(:flag_enabled) { true }
......
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