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
Jérome Perrin
gitlab-ce
Commits
32b579e8
Commit
32b579e8
authored
Aug 11, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show member roles to all users on members page
parent
4c29c254
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
2 additions
and
84 deletions
+2
-84
CHANGELOG
CHANGELOG
+1
-0
app/helpers/members_helper.rb
app/helpers/members_helper.rb
+0
-6
app/views/shared/members/_member.html.haml
app/views/shared/members/_member.html.haml
+1
-1
features/explore/groups.feature
features/explore/groups.feature
+0
-25
features/steps/explore/groups.rb
features/steps/explore/groups.rb
+0
-4
spec/helpers/members_helper_spec.rb
spec/helpers/members_helper_spec.rb
+0
-48
No files found.
CHANGELOG
View file @
32b579e8
...
...
@@ -22,6 +22,7 @@ v 8.11.0 (unreleased)
- Cache highlighted diff lines for merge requests
- Pre-create all builds for a Pipeline when the new Pipeline is created !5295
- Fix of 'Commits being passed to custom hooks are already reachable when using the UI'
- Show member roles to all users on members page
- Fix awardable button mutuality loading spinners (ClemMakesApps)
- Add support for using RequestStore within Sidekiq tasks via SIDEKIQ_REQUEST_STORE env variable
- Optimize maximum user access level lookup in loading of notes
...
...
app/helpers/members_helper.rb
View file @
32b579e8
...
...
@@ -6,12 +6,6 @@ module MembersHelper
"
#{
action
}
_
#{
member
.
type
.
underscore
}
"
.
to_sym
end
def
default_show_roles
(
member
)
can?
(
current_user
,
action_member_permission
(
:update
,
member
),
member
)
||
can?
(
current_user
,
action_member_permission
(
:destroy
,
member
),
member
)
||
can?
(
current_user
,
action_member_permission
(
:admin
,
member
),
member
.
source
)
end
def
remove_member_message
(
member
,
user:
nil
)
user
=
current_user
if
defined?
(
current_user
)
...
...
app/views/shared/members/_member.html.haml
View file @
32b579e8
-
show_roles
=
local_assigns
.
fetch
(
:show_roles
,
default_show_roles
(
member
)
)
-
show_roles
=
local_assigns
.
fetch
(
:show_roles
,
true
)
-
show_controls
=
local_assigns
.
fetch
(
:show_controls
,
true
)
-
user
=
member
.
user
...
...
features/explore/groups.feature
View file @
32b579e8
...
...
@@ -24,14 +24,6 @@ Feature: Explore Groups
Then
I should see project
"Internal"
items
And
I should not see project
"Enterprise"
items
Scenario
:
I
should see group's members as user
Given
group
"TestGroup"
has internal project
"Internal"
And
"John Doe"
is owner of group
"TestGroup"
When
I sign in as a user
And
I visit group
"TestGroup"
members page
Then
I should see group member
"John Doe"
And
I should not see member roles
Scenario
:
I
should see group with private, internal and public projects as visitor
Given
group
"TestGroup"
has internal project
"Internal"
Given
group
"TestGroup"
has public project
"Community"
...
...
@@ -56,14 +48,6 @@ Feature: Explore Groups
And
I should not see project
"Internal"
items
And
I should not see project
"Enterprise"
items
Scenario
:
I
should see group's members as visitor
Given
group
"TestGroup"
has internal project
"Internal"
Given
group
"TestGroup"
has public project
"Community"
And
"John Doe"
is owner of group
"TestGroup"
When
I visit group
"TestGroup"
members page
Then
I should see group member
"John Doe"
And
I should not see member roles
Scenario
:
I
should see group with private, internal and public projects as user
Given
group
"TestGroup"
has internal project
"Internal"
Given
group
"TestGroup"
has public project
"Community"
...
...
@@ -91,15 +75,6 @@ Feature: Explore Groups
And
I should see project
"Internal"
items
And
I should not see project
"Enterprise"
items
Scenario
:
I
should see group's members as user
Given
group
"TestGroup"
has internal project
"Internal"
Given
group
"TestGroup"
has public project
"Community"
And
"John Doe"
is owner of group
"TestGroup"
When
I sign in as a user
And
I visit group
"TestGroup"
members page
Then
I should see group member
"John Doe"
And
I should not see member roles
Scenario
:
I
should see group with public project in public groups area
Given
group
"TestGroup"
has public project
"Community"
When
I visit the public groups area
...
...
features/steps/explore/groups.rb
View file @
32b579e8
...
...
@@ -62,10 +62,6 @@ class Spinach::Features::ExploreGroups < Spinach::FeatureSteps
expect
(
page
).
to
have_content
"John Doe"
end
step
'I should not see member roles'
do
expect
(
body
).
not_to
match
(
%r{owner|developer|reporter|guest}i
)
end
protected
def
group_has_project
(
groupname
,
projectname
,
visibility_level
)
...
...
spec/helpers/members_helper_spec.rb
View file @
32b579e8
...
...
@@ -9,54 +9,6 @@ describe MembersHelper do
it
{
expect
(
action_member_permission
(
:admin
,
group_member
)).
to
eq
:admin_group_member
}
end
describe
'#default_show_roles'
do
let
(
:user
)
{
double
}
let
(
:member
)
{
build
(
:project_member
)
}
before
do
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
allow
(
helper
).
to
receive
(
:can?
).
with
(
user
,
:update_project_member
,
member
).
and_return
(
false
)
allow
(
helper
).
to
receive
(
:can?
).
with
(
user
,
:destroy_project_member
,
member
).
and_return
(
false
)
allow
(
helper
).
to
receive
(
:can?
).
with
(
user
,
:admin_project_member
,
member
.
source
).
and_return
(
false
)
end
context
'when the current cannot update, destroy or admin the passed member'
do
it
'returns false'
do
expect
(
helper
.
default_show_roles
(
member
)).
to
be_falsy
end
end
context
'when the current can update the passed member'
do
before
do
allow
(
helper
).
to
receive
(
:can?
).
with
(
user
,
:update_project_member
,
member
).
and_return
(
true
)
end
it
'returns true'
do
expect
(
helper
.
default_show_roles
(
member
)).
to
be_truthy
end
end
context
'when the current can destroy the passed member'
do
before
do
allow
(
helper
).
to
receive
(
:can?
).
with
(
user
,
:destroy_project_member
,
member
).
and_return
(
true
)
end
it
'returns true'
do
expect
(
helper
.
default_show_roles
(
member
)).
to
be_truthy
end
end
context
'when the current can admin the passed member source'
do
before
do
allow
(
helper
).
to
receive
(
:can?
).
with
(
user
,
:admin_project_member
,
member
.
source
).
and_return
(
true
)
end
it
'returns true'
do
expect
(
helper
.
default_show_roles
(
member
)).
to
be_truthy
end
end
end
describe
'#remove_member_message'
do
let
(
:requester
)
{
build
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
...
...
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