Commit 89c22ed5 authored by Phil Hughes's avatar Phil Hughes

Shows group members in the project members list

Closes #24122
parent 2f91c0ee
...@@ -10,14 +10,32 @@ class Projects::ProjectMembersController < Projects::ApplicationController ...@@ -10,14 +10,32 @@ class Projects::ProjectMembersController < Projects::ApplicationController
@project_members = @project.project_members @project_members = @project.project_members
@project_members = @project_members.non_invite unless can?(current_user, :admin_project, @project) @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? if params[:search].present?
users = @project.users.search(params[:search]).to_a users = @project.users.search(params[:search]).to_a
@project_members = @project_members.where(user_id: users) @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)) @group_links = @project.project_group_links.where(group_id: @project.invited_groups.search(params[:search]).select(:id))
end 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) @requesters = AccessRequestsFinder.new(@project).execute(current_user)
......
...@@ -12,6 +12,10 @@ ...@@ -12,6 +12,10 @@
= link_to user.name, user_path(user) = link_to user.name, user_path(user)
%span.cgray= user.to_reference %span.cgray= user.to_reference
- if member.real_source_type == 'Group'
&middot;
%span.cblue=member.group.name
- if user == current_user - if user == current_user
%span.label.label-success.prepend-left-5 It's you %span.label.label-success.prepend-left-5 It's you
...@@ -45,7 +49,7 @@ ...@@ -45,7 +49,7 @@
= time_ago_with_tooltip(member.created_at) = time_ago_with_tooltip(member.created_at)
- if show_roles - if show_roles
.controls.member-controls .controls.member-controls
- if show_controls - if show_controls && member.real_source_type == 'Project'
- if user != current_user - if user != current_user
= form_for member, remote: true, html: { class: 'form-horizontal js-edit-member-form' } do |f| = form_for member, remote: true, html: { class: 'form-horizontal js-edit-member-form' } do |f|
= f.select :access_level, options_for_select(member.class.access_level_roles, member.access_level), {}, class: 'form-control member-form-control append-right-5 js-member-update-control', id: "member_access_level_#{member.id}", disabled: !can_admin_member = f.select :access_level, options_for_select(member.class.access_level_roles, member.access_level), {}, class: 'form-control member-form-control append-right-5 js-member-update-control', id: "member_access_level_#{member.id}", disabled: !can_admin_member
......
---
title: Shows group members in project members list
merge_request:
author:
require 'spec_helper'
feature 'Projects members', feature: true do
let(:user) { create(:user) }
let(:group) { create(:group) }
let(:project) { create(:project, group: group) }
background do
group.add_owner(user)
login_as(user)
visit namespace_project_project_members_path(project.namespace, project)
end
it 'shows group members in list' do
expect(page).to have_selector('.group_member')
page.within first('.content-list .member') do
expect(page).to have_content(group.name)
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment