Commit 18c9fc42 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Use a block to insert extra check for authenticate_build!

Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8091#note_20253762
parent a0690c4c
......@@ -14,13 +14,16 @@ module Ci
end
def authenticate_build!(build)
not_found! unless build
validate_build!(build) do
forbidden! unless build_token_valid?(build)
validate_build!(build)
end
end
def validate_build!(build)
not_found! unless build
yield if block_given?
forbidden!('Project has been deleted!') unless build.project
forbidden!('Build has been erased!') if build.erased?
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