summaryrefslogtreecommitdiff
path: root/app/services/ci/create_pipeline_service.rb
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-07-19 22:37:38 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-07-19 22:37:38 +0800
commitd035d735242a47bee7cd5973c9daa7d984800700 (patch)
tree0a1d584bb2836b7b73c7054d85ffff043208d625 /app/services/ci/create_pipeline_service.rb
parenta397a0eb1a4c34c27175e2c4e68e7ceb43a81f02 (diff)
downloadgitlab-ce-d035d735242a47bee7cd5973c9daa7d984800700.tar.gz
Fix tests and fine tweak permission error message
Diffstat (limited to 'app/services/ci/create_pipeline_service.rb')
-rw-r--r--app/services/ci/create_pipeline_service.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/app/services/ci/create_pipeline_service.rb b/app/services/ci/create_pipeline_service.rb
index f331f86e622..700ac42d56e 100644
--- a/app/services/ci/create_pipeline_service.rb
+++ b/app/services/ci/create_pipeline_service.rb
@@ -23,16 +23,16 @@ module Ci
unless allowed_to_trigger_pipeline?(triggering_user)
if can?(triggering_user, :create_pipeline, project)
- return error("Insufficient permissions for protected ref '#{ref}'")
+ if branch? || tag?
+ return error("Insufficient permissions for protected ref '#{ref}'")
+ else
+ return error('Reference not found')
+ end
else
return error('Insufficient permissions to create a new pipeline')
end
end
- unless branch? || tag?
- return error('Reference not found')
- end
-
unless commit
return error('Commit not found')
end