diff options
author | Dmitriy Zaporozhets <dzaporozhets@gitlab.com> | 2015-01-12 16:57:20 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dzaporozhets@gitlab.com> | 2015-01-12 16:57:20 +0000 |
commit | 6643d38f9790404eee17034a6e003beebadaf197 (patch) | |
tree | c3f97ac517b4b4ce71e959a7b6e851a00652fbed /lib/api/projects.rb | |
parent | 31bcd04711d448c016506897b8431273e3454faa (diff) | |
parent | ef0cf7b42dbdd7a017450ada45881134524e4997 (diff) | |
download | gitlab-ce-6643d38f9790404eee17034a6e003beebadaf197.tar.gz |
Merge branch 'add_search_option_to_project_api' into 'master'
Add search option to project api
When using Ajax to search for users authorised projects we need to do a search query on the returned list rather than doing a request using `/search/:query` option.
This MR also adds a simple spec for project ordering feature that got added in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/266 but no specs were provided.
See merge request !1385
Diffstat (limited to 'lib/api/projects.rb')
-rw-r--r-- | lib/api/projects.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb index e1cc2348865..b9c95c785f2 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -15,9 +15,6 @@ module API # Get a projects list for authenticated user # - # Parameters: - # archived (optional) - if passed, limit by archived status - # # Example Request: # GET /projects get do @@ -37,6 +34,10 @@ module API @projects = @projects.where(archived: parse_boolean(params[:archived])) end + if params[:search].present? + @projects = @projects.search(params[:search]) + end + @projects = paginate @projects present @projects, with: Entities::Project end |