diff options
author | Jacopo <beschi.jacopo@gmail.com> | 2017-03-03 11:35:04 +0100 |
---|---|---|
committer | Jacopo <beschi.jacopo@gmail.com> | 2017-04-06 07:11:37 +0200 |
commit | b996a82ff44e3bcad5e5fb70cabbfa808d06cf62 (patch) | |
tree | d5a39a4a0e1b8d26eb9d6c47d817b2a0ff6ba6ce /app/controllers/groups_controller.rb | |
parent | 280531a762e4922761b79403934c549203e5b45f (diff) | |
download | gitlab-ce-b996a82ff44e3bcad5e5fb70cabbfa808d06cf62.tar.gz |
ProjectsFinder should handle more options
Extended ProjectFinder in order to handle the following options:
- current_user - which user use
- project_ids_relation: int[] - project ids to use
- params:
- trending: boolean
- non_public: boolean
- starred: boolean
- sort: string
- visibility_level: int
- tags: string[]
- personal: boolean
- search: string
- non_archived: boolean
GroupProjectsFinder now inherits from ProjectsFinder.
Changed the code in order to use the new available options.
Diffstat (limited to 'app/controllers/groups_controller.rb')
-rw-r--r-- | app/controllers/groups_controller.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 05f9ee1ee90..78c9f1f7004 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -1,7 +1,7 @@ class GroupsController < Groups::ApplicationController - include FilterProjects include IssuesAction include MergeRequestsAction + include ParamsBackwardCompatibility respond_to :html @@ -105,15 +105,16 @@ class GroupsController < Groups::ApplicationController protected def setup_projects + set_non_archived_param + params[:sort] ||= 'latest_activity_desc' + @sort = params[:sort] + options = {} options[:only_owned] = true if params[:shared] == '0' options[:only_shared] = true if params[:shared] == '1' - @projects = GroupProjectsFinder.new(group, options).execute(current_user) + @projects = GroupProjectsFinder.new(params: params, group: group, options: options, current_user: current_user).execute @projects = @projects.includes(:namespace) - @projects = @projects.sorted_by_activity - @projects = filter_projects(@projects) - @projects = @projects.sort(@sort = params[:sort]) @projects = @projects.page(params[:page]) if params[:name].blank? end |