diff options
author | Phil Hughes <me@iamphill.com> | 2016-12-02 14:34:08 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-12-02 16:49:53 +0000 |
commit | 89c22ed5af490f250800030ee4342c185dbc5358 (patch) | |
tree | 844588a0c4c941aafc3a05481f380d22f1b4ebf5 /app/controllers/projects/project_members_controller.rb | |
parent | 2f91c0eef45e9501ba90976a64886aee56b90b46 (diff) | |
download | gitlab-ce-89c22ed5af490f250800030ee4342c185dbc5358.tar.gz |
Shows group members in the project members list
Closes #24122
Diffstat (limited to 'app/controllers/projects/project_members_controller.rb')
-rw-r--r-- | app/controllers/projects/project_members_controller.rb | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/app/controllers/projects/project_members_controller.rb b/app/controllers/projects/project_members_controller.rb index 699a56ae2f8..ccf5ff35171 100644 --- a/app/controllers/projects/project_members_controller.rb +++ b/app/controllers/projects/project_members_controller.rb @@ -10,14 +10,32 @@ class Projects::ProjectMembersController < Projects::ApplicationController @project_members = @project.project_members @project_members = @project_members.non_invite unless can?(current_user, :admin_project, @project) + @group = @project.group + + if @group + @group_members = @group.group_members + @group_members = @group_members.non_invite unless can?(current_user, :admin_group, @group) + end + if params[:search].present? users = @project.users.search(params[:search]).to_a @project_members = @project_members.where(user_id: users) + if @group_members + users = @group.users.search(params[:search]).to_a + @group_members = @group_members.where(user_id: users) + end + @group_links = @project.project_group_links.where(group_id: @project.invited_groups.search(params[:search]).select(:id)) end - @project_members = @project_members.order(access_level: :desc).page(params[:page]) + members_id = @project_members.pluck(:id) + + if @group_members + members_id << @group_members.select{ |member| !@project_members.find_by(user_id: member.user_id) }.select(&:id) + end + + @project_members = Member.where(id: members_id.flatten).order(access_level: :desc).page(params[:page]) @requesters = AccessRequestsFinder.new(@project).execute(current_user) |