Skip to content
Snippets Groups Projects
Commit 87ff0107 authored by Lin Jen-Shin's avatar Lin Jen-Shin
Browse files

Raise one by one instead of if checks

parent 347ee6cc
No related branches found
No related tags found
1 merge request!3363Implement #3243 New Issue by email
Loading
Loading
@@ -76,16 +76,11 @@ module Gitlab
end
 
def validate_permission(author, project, permission)
if author
if author.blocked?
raise UserBlockedError
elsif project.nil? || !author.can?(permission, project)
# TODO: Give project not found error if author cannot read project
raise UserNotAuthorizedError
end
else
raise UserNotFoundError
end
raise UserNotFoundError unless author
raise UserBlockedError if author.blocked?
# TODO: Give project not found error if author cannot read project
raise UserNotAuthorizedError if project.nil? ||
!author.can?(permission, project)
end
 
# Find the first matched user in database from email From: section
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment