summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-07-06 17:37:27 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-07-06 17:37:27 +0800
commit550ccf443059412a26adfcba15fbe9d05d39a5f9 (patch)
tree588c4b6332a134eb4d6a852d38341331ec2c5f4e
parent56ea7a0cfe0fcdff33de80fd4602f463367914b2 (diff)
downloadgitlab-ce-550ccf443059412a26adfcba15fbe9d05d39a5f9.tar.gz
Make message and code more clear
-rw-r--r--app/services/ci/create_pipeline_service.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/app/services/ci/create_pipeline_service.rb b/app/services/ci/create_pipeline_service.rb
index 485161e5f3f..a8034e30a85 100644
--- a/app/services/ci/create_pipeline_service.rb
+++ b/app/services/ci/create_pipeline_service.rb
@@ -28,7 +28,7 @@ module Ci
end
unless triggering_user_allowed_for_ref?(trigger_request)
- return error("Insufficient permissions for protected #{ref}")
+ return error("Insufficient permissions for protected ref '#{ref}'")
end
unless commit
@@ -77,8 +77,11 @@ module Ci
def triggering_user_allowed_for_ref?(trigger_request)
triggering_user = current_user || trigger_request.trigger.owner
- (triggering_user && allowed_to_create?(triggering_user)) ||
+ if triggering_user
+ allowed_to_create?(triggering_user)
+ else # legacy triggers don't have a corresponding user
!project.protected_for?(ref)
+ end
end
def allowed_to_create?(triggering_user)