summaryrefslogtreecommitdiff
path: root/lib/api/projects.rb
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2017-05-22 16:48:38 +0200
committerToon Claes <toon@gitlab.com>2017-05-30 22:45:58 +0200
commit4fda13b68eb7da27be5e74cac6d3d537502b19f7 (patch)
treea9c9f4e37c7a8867588049be2185cf97f5e8ffe4 /lib/api/projects.rb
parent44fdf0a1e314da517d189e356b0e44bb63cf0f4b (diff)
downloadgitlab-ce-4fda13b68eb7da27be5e74cac6d3d537502b19f7.tar.gz
Build options hash after finding the list of projects
Because this order makes more sense and makes the code easier to read.
Diffstat (limited to 'lib/api/projects.rb')
-rw-r--r--lib/api/projects.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index fce496308c3..ef09dfa0102 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -68,16 +68,17 @@ module API
end
def present_projects(options = {})
- options = options.reverse_merge(
- with: current_user ? Entities::ProjectWithAccess : Entities::BasicProjectDetails,
- current_user: current_user
- )
-
projects = ProjectsFinder.new(current_user: current_user).execute
projects = filter_projects(projects)
projects = projects.with_statistics if params[:statistics]
projects = projects.with_issues_enabled if params[:with_issues_enabled]
projects = projects.with_merge_requests_enabled if params[:with_merge_requests_enabled]
+
+ options = options.reverse_merge(
+ with: current_user ? Entities::ProjectWithAccess : Entities::BasicProjectDetails,
+ statistics: params[:statistics],
+ current_user: current_user
+ )
options[:with] = Entities::BasicProjectDetails if params[:simple]
present paginate(projects), options