Commit 94edafdf authored by Rémy Coutable's avatar Rémy Coutable

Inverse condition in Members::RequestAccessService

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 690d19db
...@@ -8,7 +8,7 @@ module Members ...@@ -8,7 +8,7 @@ module Members
end end
def execute def execute
raise Gitlab::Access::AccessDeniedError if cannot_request_access?(source) raise Gitlab::Access::AccessDeniedError unless can_request_access?(source)
source.members.create( source.members.create(
access_level: Gitlab::Access::DEVELOPER, access_level: Gitlab::Access::DEVELOPER,
...@@ -18,8 +18,8 @@ module Members ...@@ -18,8 +18,8 @@ module Members
private private
def cannot_request_access?(source) def can_request_access?(source)
!source || !can?(current_user, :request_access, source) source && can?(current_user, :request_access, source)
end end
end 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