diff options
Diffstat (limited to 'app/controllers/groups_controller.rb')
-rw-r--r-- | app/controllers/groups_controller.rb | 44 |
1 files changed, 15 insertions, 29 deletions
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index a962d82e3b5..bc3e95f1aed 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -46,15 +46,11 @@ class GroupsController < Groups::ApplicationController end def show - setup_projects - respond_to do |format| - format.html - - format.json do - render json: { - html: view_to_html_string("dashboard/projects/_projects", locals: { projects: @projects }) - } + format.html do + @has_children = GroupDescendantsFinder.new(current_user: current_user, + parent_group: @group, + params: params).has_children? end format.atom do @@ -64,13 +60,6 @@ class GroupsController < Groups::ApplicationController end end - def subgroups - return not_found unless Group.supports_nested_groups? - - @nested_groups = GroupsFinder.new(current_user, parent: group).execute - @nested_groups = @nested_groups.search(params[:filter_groups]) if params[:filter_groups].present? - end - def activity respond_to do |format| format.html @@ -107,20 +96,6 @@ 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(params: params, group: group, options: options, current_user: current_user).execute - @projects = @projects.includes(:namespace) - @projects = @projects.page(params[:page]) if params[:name].blank? - end - def authorize_create_group! allowed = if params[:parent_id].present? parent = Group.find_by(id: params[:parent_id]) @@ -166,6 +141,17 @@ class GroupsController < Groups::ApplicationController end def load_events + params[:sort] ||= 'latest_activity_desc' + + options = {} + options[:only_owned] = true if params[:shared] == '0' + options[:only_shared] = true if params[:shared] == '1' + + @projects = GroupProjectsFinder.new(params: params, group: group, options: options, current_user: current_user) + .execute + .includes(:namespace) + .page(params[:page]) + @events = EventCollection .new(@projects, offset: params[:offset].to_i, filter: event_filter) .to_a |