diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-31 12:08:33 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-31 12:08:33 +0000 |
commit | 1808454313ed75c92e1384466e8c83bfbc8ae25e (patch) | |
tree | 5c006c158fd796dc6d21e9bd771542f2fb0c24e2 /app/controllers/projects/project_members_controller.rb | |
parent | fd3a95f07ae9cd78fecffcfa5de4494f933a7808 (diff) | |
download | gitlab-ce-1808454313ed75c92e1384466e8c83bfbc8ae25e.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers/projects/project_members_controller.rb')
-rw-r--r-- | app/controllers/projects/project_members_controller.rb | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/app/controllers/projects/project_members_controller.rb b/app/controllers/projects/project_members_controller.rb index 7bd084458d1..109c8b7005f 100644 --- a/app/controllers/projects/project_members_controller.rb +++ b/app/controllers/projects/project_members_controller.rb @@ -8,27 +8,26 @@ class Projects::ProjectMembersController < Projects::ApplicationController # Authorize before_action :authorize_admin_project_member!, except: [:index, :leave, :request_access] - # rubocop: disable CodeReuse/ActiveRecord def index @sort = params[:sort].presence || sort_value_name + + @skip_groups = @project.invited_group_ids + @skip_groups += @project.group.self_and_ancestors_ids if @project.group + @group_links = @project.project_group_links + @group_links = @group_links.search(params[:search]) if params[:search].present? - @skip_groups = @group_links.pluck(:group_id) - @skip_groups << @project.namespace_id unless @project.personal? - @skip_groups += @project.group.ancestors.pluck(:id) if @project.group + @project_members = MembersFinder.new(@project, current_user) + .execute(include_relations: requested_relations, params: params.merge(sort: @sort)) - @project_members = MembersFinder.new(@project, current_user).execute(include_relations: requested_relations) + @project_members = present_members(@project_members.page(params[:page])) - if params[:search].present? - @project_members = @project_members.joins(:user).merge(User.search(params[:search])) - @group_links = @group_links.where(group_id: @project.invited_groups.search(params[:search]).select(:id)) - end + @requesters = present_members( + AccessRequestsFinder.new(@project).execute(current_user) + ) - @project_members = present_members(@project_members.sort_by_attribute(@sort).page(params[:page])) - @requesters = present_members(AccessRequestsFinder.new(@project).execute(current_user)) @project_member = @project.project_members.new end - # rubocop: enable CodeReuse/ActiveRecord def import @projects = current_user.authorized_projects.order_id_desc |