Simply give result if result[:status] == :error
This commit is contained in:
parent
cf677378ee
commit
691f1c4968
1 changed files with 3 additions and 11 deletions
|
@ -1,8 +1,9 @@
|
|||
class CreateBranchService < BaseService
|
||||
def execute(branch_name, ref)
|
||||
failure = validate_new_branch(branch_name)
|
||||
result = ValidateNewBranchService.new(project, current_user).
|
||||
execute(branch_name)
|
||||
|
||||
return failure if failure
|
||||
return result if result[:status] == :error
|
||||
|
||||
new_branch = repository.add_branch(current_user, branch_name, ref)
|
||||
|
||||
|
@ -18,13 +19,4 @@ class CreateBranchService < BaseService
|
|||
def success(branch)
|
||||
super().merge(branch: branch)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def validate_new_branch(branch_name)
|
||||
result = ValidateNewBranchService.new(project, current_user).
|
||||
execute(branch_name)
|
||||
|
||||
error(result[:message]) if result[:status] == :error
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue