diff options
author | Robert Schilling <rschilling@student.tugraz.at> | 2016-11-09 15:51:27 +0100 |
---|---|---|
committer | Robert Schilling <rschilling@student.tugraz.at> | 2016-11-28 21:01:43 +0100 |
commit | 7c607a55ab339293b0e67eeb33439d5407e22aad (patch) | |
tree | 69b7bbbc650827970fbea72d662918de2017237e /lib/api/helpers.rb | |
parent | c54827961a6ecefc6cb3361b3978d169e29b5e36 (diff) | |
download | gitlab-ce-7c607a55ab339293b0e67eeb33439d5407e22aad.tar.gz |
Grapify the projects APIgrapify-projects-api
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r-- | lib/api/helpers.rb | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index 0d3ddb89dc3..2fd50143e91 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -324,11 +324,6 @@ module API # Projects helpers def filter_projects(projects) - # If the archived parameter is passed, limit results accordingly - if params[:archived].present? - projects = projects.where(archived: to_boolean(params[:archived])) - end - if params[:search].present? projects = projects.search(params[:search]) end @@ -337,25 +332,8 @@ module API projects = projects.search_by_visibility(params[:visibility]) end - projects.reorder(project_order_by => project_sort) - end - - def project_order_by - order_fields = %w(id name path created_at updated_at last_activity_at) - - if order_fields.include?(params['order_by']) - params['order_by'] - else - 'created_at' - end - end - - def project_sort - if params["sort"] == 'asc' - :asc - else - :desc - end + projects = projects.where(archived: params[:archived]) + projects.reorder(params[:order_by] => params[:sort]) end # file helpers |