diff options
author | Alexis Reigel <alexis.reigel.ext@siemens.com> | 2019-02-06 20:55:58 +0100 |
---|---|---|
committer | Alexis Reigel <alexis.reigel.ext@siemens.com> | 2019-03-14 18:39:54 +0100 |
commit | fcf90d051ba2c0e57b3df65711d4ed6b846cfb8e (patch) | |
tree | 53cf8f354b2af2766b8494ad949b278583e26a5c | |
parent | b0981097c302dd04df23ec557b4dcce5c952f2bf (diff) | |
download | gitlab-ce-fcf90d051ba2c0e57b3df65711d4ed6b846cfb8e.tar.gz |
un-dry the search api scope
due to the usage in EE this attempt to more DRYness is not worth it.
-rw-r--r-- | lib/api/search.rb | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/api/search.rb b/lib/api/search.rb index 30e68c5aac1..de3ed3d4540 100644 --- a/lib/api/search.rb +++ b/lib/api/search.rb @@ -58,15 +58,6 @@ module API render_api_error!({ error: _("Scope not supported with disabled 'users_search' feature!") }, 400) end end - - params :scope do |options| - values = SCOPE_ENTITY.stringify_keys.slice(*options[:values]).keys - - requires :scope, - type: String, - desc: 'The scope of the search', - values: values - end end resource :search do @@ -75,7 +66,10 @@ module API end params do requires :search, type: String, desc: 'The expression it should be searched for' - use :scope, values: Helpers::SearchHelpers.global_search_scopes + requires :scope, + type: String, + desc: 'The scope of the search', + values: Helpers::SearchHelpers.global_search_scopes use :pagination end get do @@ -93,7 +87,10 @@ module API params do requires :id, type: String, desc: 'The ID of a group' requires :search, type: String, desc: 'The expression it should be searched for' - use :scope, values: Helpers::SearchHelpers.group_search_scopes + requires :scope, + type: String, + desc: 'The scope of the search', + values: Helpers::SearchHelpers.group_search_scopes use :pagination end get ':id/(-/)search' do @@ -111,7 +108,10 @@ module API params do requires :id, type: String, desc: 'The ID of a project' requires :search, type: String, desc: 'The expression it should be searched for' - use :scope, Helpers::SearchHelpers.project_search_scopes + requires :scope, + type: String, + desc: 'The scope of the search', + values: Helpers::SearchHelpers.project_search_scopes use :pagination end get ':id/(-/)search' do |