Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
89c22ed5
Commit
89c22ed5
authored
Dec 02, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Shows group members in the project members list
Closes #24122
parent
2f91c0ee
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
2 deletions
+49
-2
app/controllers/projects/project_members_controller.rb
app/controllers/projects/project_members_controller.rb
+19
-1
app/views/shared/members/_member.html.haml
app/views/shared/members/_member.html.haml
+5
-1
changelogs/unreleased/group-members-in-project-members-view.yml
...logs/unreleased/group-members-in-project-members-view.yml
+4
-0
spec/features/projects/members/group_members_spec.rb
spec/features/projects/members/group_members_spec.rb
+21
-0
No files found.
app/controllers/projects/project_members_controller.rb
View file @
89c22ed5
...
@@ -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
)
...
...
app/views/shared/members/_member.html.haml
View file @
89c22ed5
...
@@ -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'
·
%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
...
...
changelogs/unreleased/group-members-in-project-members-view.yml
0 → 100644
View file @
89c22ed5
---
title
:
Shows group members in project members list
merge_request
:
author
:
spec/features/projects/members/group_members_spec.rb
0 → 100644
View file @
89c22ed5
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment