Commit a14db4a2 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'ce-reduce-diff-in-search-global_service' into 'master'

Reduce diff with EE in Search::GlobalService

See merge request gitlab-org/gitlab-ce!24914
parents e37abfbb 787cbc89
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
module Search module Search
class GlobalService class GlobalService
include Gitlab::Utils::StrongMemoize
attr_accessor :current_user, :params attr_accessor :current_user, :params
attr_reader :default_project_filter attr_reader :default_project_filter
...@@ -19,11 +21,15 @@ module Search ...@@ -19,11 +21,15 @@ module Search
@projects ||= ProjectsFinder.new(current_user: current_user).execute @projects ||= ProjectsFinder.new(current_user: current_user).execute
end end
def scope def allowed_scopes
@scope ||= begin strong_memoize(:allowed_scopes) do
allowed_scopes = %w[issues merge_requests milestones] %w[issues merge_requests milestones]
end
end
allowed_scopes.delete(params[:scope]) { 'projects' } def scope
strong_memoize(:scope) do
allowed_scopes.include?(params[:scope]) ? params[:scope] : 'projects'
end end
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