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
Boxiang Sun
gitlab-ce
Commits
e9d7b4f7
Commit
e9d7b4f7
authored
Sep 16, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Invert method's naming
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
c8b13119
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
app/services/members/destroy_service.rb
app/services/members/destroy_service.rb
+3
-3
spec/requests/api/access_requests_spec.rb
spec/requests/api/access_requests_spec.rb
+1
-1
No files found.
app/services/members/destroy_service.rb
View file @
e9d7b4f7
...
@@ -17,7 +17,7 @@ module Members
...
@@ -17,7 +17,7 @@ module Members
member
=
find_member!
(
scope
)
member
=
find_member!
(
scope
)
raise
Gitlab
::
Access
::
AccessDeniedError
if
cannot
_destroy_member?
(
member
)
raise
Gitlab
::
Access
::
AccessDeniedError
unless
can
_destroy_member?
(
member
)
AuthorizedDestroyService
.
new
(
member
,
current_user
).
execute
AuthorizedDestroyService
.
new
(
member
,
current_user
).
execute
end
end
...
@@ -35,8 +35,8 @@ module Members
...
@@ -35,8 +35,8 @@ module Members
end
end
end
end
def
can
not
_destroy_member?
(
member
)
def
can_destroy_member?
(
member
)
!
member
||
!
can?
(
current_user
,
action_member_permission
(
:destroy
,
member
),
member
)
member
&&
can?
(
current_user
,
action_member_permission
(
:destroy
,
member
),
member
)
end
end
end
end
end
end
spec/requests/api/access_requests_spec.rb
View file @
e9d7b4f7
...
@@ -213,7 +213,7 @@ describe API::AccessRequests, api: true do
...
@@ -213,7 +213,7 @@ describe API::AccessRequests, api: true do
end
.
to
change
{
source
.
requesters
.
count
}.
by
(
-
1
)
end
.
to
change
{
source
.
requesters
.
count
}.
by
(
-
1
)
end
end
context
'user_id matches a member'
do
context
'user_id matches a member
, not an access requester
'
do
it
'returns 404'
do
it
'returns 404'
do
expect
do
expect
do
delete
api
(
"/
#{
source_type
.
pluralize
}
/
#{
source
.
id
}
/access_requests/
#{
developer
.
id
}
"
,
master
)
delete
api
(
"/
#{
source_type
.
pluralize
}
/
#{
source
.
id
}
/access_requests/
#{
developer
.
id
}
"
,
master
)
...
...
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