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
cc66ec2b
Commit
cc66ec2b
authored
Dec 02, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed Ruby to be better for performance
Fixed controls not showing in groups which fixes tests
parent
89c22ed5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
18 deletions
+14
-18
app/controllers/projects/project_members_controller.rb
app/controllers/projects/project_members_controller.rb
+11
-11
app/views/shared/members/_member.html.haml
app/views/shared/members/_member.html.haml
+3
-7
No files found.
app/controllers/projects/project_members_controller.rb
View file @
cc66ec2b
...
@@ -10,20 +10,20 @@ class Projects::ProjectMembersController < Projects::ApplicationController
...
@@ -10,20 +10,20 @@ 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
group
=
@project
.
group
if
@
group
if
group
@group_members
=
@group
.
group_members
group_members
=
group
.
group_members
.
where
.
not
(
user_id:
@project_members
.
select
(
:user_id
))
@group_members
=
@
group_members
.
non_invite
unless
can?
(
current_user
,
:admin_group
,
@group
)
group_members
=
group_members
.
non_invite
unless
can?
(
current_user
,
:admin_group
,
@group
)
end
end
if
params
[
:search
].
present?
if
params
[
:search
].
present?
user
s
=
@project
.
users
.
search
(
params
[
:search
]).
to_a
user
_ids
=
@project
.
users
.
search
(
params
[
:search
]).
select
(
:id
)
@project_members
=
@project_members
.
where
(
user_id:
users
)
@project_members
=
@project_members
.
where
(
user_id:
user
_id
s
)
if
@
group_members
if
group_members
user
s
=
@group
.
users
.
search
(
params
[
:search
]).
to_a
user
_ids
=
group
.
users
.
search
(
params
[
:search
]).
select
(
:id
)
@group_members
=
@group_members
.
where
(
user_id:
user
s
)
group_members
=
group_members
.
where
(
user_id:
user_id
s
)
end
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
))
...
@@ -31,8 +31,8 @@ class Projects::ProjectMembersController < Projects::ApplicationController
...
@@ -31,8 +31,8 @@ class Projects::ProjectMembersController < Projects::ApplicationController
members_id
=
@project_members
.
pluck
(
:id
)
members_id
=
@project_members
.
pluck
(
:id
)
if
@
group_members
if
group_members
members_id
<<
@group_members
.
select
{
|
member
|
!
@project_members
.
find_by
(
user_id:
member
.
user_id
)
}.
select
(
&
:id
)
members_id
<<
group_members
.
pluck
(
:id
)
end
end
@project_members
=
Member
.
where
(
id:
members_id
.
flatten
).
order
(
access_level: :desc
).
page
(
params
[
:page
])
@project_members
=
Member
.
where
(
id:
members_id
.
flatten
).
order
(
access_level: :desc
).
page
(
params
[
:page
])
...
...
app/views/shared/members/_member.html.haml
View file @
cc66ec2b
...
@@ -12,10 +12,6 @@
...
@@ -12,10 +12,6 @@
=
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
...
@@ -24,8 +20,8 @@
...
@@ -24,8 +20,8 @@
%strong
Blocked
%strong
Blocked
-
if
source
.
instance_of?
(
Group
)
&&
!
@group
-
if
source
.
instance_of?
(
Group
)
&&
!
@group
=
link_to
source
,
class:
"member-group-link prepend-left-5"
do
·
=
"·
#{
source
.
name
}
"
=
link_to
source
.
name
,
source
,
class:
"member-group-link
"
.hidden-xs.cgray
.hidden-xs.cgray
-
if
member
.
request?
-
if
member
.
request?
...
@@ -49,7 +45,7 @@
...
@@ -49,7 +45,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
&&
member
.
real_source_type
==
'Project'
-
if
show_controls
&&
(
member
.
respond_to?
(
:group
)
&&
@members
)
||
(
member
.
respond_to?
(
:project
)
&&
@project_members
)
-
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
...
...
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