summaryrefslogtreecommitdiff
path: root/lib/api/triggers.rb
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-11-25 12:17:23 +0000
committerYorick Peterse <yorickpeterse@gmail.com>2016-11-25 12:17:23 +0000
commit838c1aad68e8c7f81a0b8778f46f0ce4e7c5439d (patch)
treeb8ca9fabfb7e7dfedccb75896bb87ba6e5a57177 /lib/api/triggers.rb
parentafe90d529c82566886d1f2513dd6bee4fa73ff94 (diff)
parent81ba3f9177fcfd76f6b3b715c572ce4920398345 (diff)
downloadgitlab-ce-838c1aad68e8c7f81a0b8778f46f0ce4e7c5439d.tar.gz
Merge branch '22373-reduce-queries-in-api-helpers-find_project' into 'master'
Resolve "Reduce queries in API::Helpers#find_project" See merge request !7714
Diffstat (limited to 'lib/api/triggers.rb')
-rw-r--r--lib/api/triggers.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/api/triggers.rb b/lib/api/triggers.rb
index 569598fbd2c..bb4de39def1 100644
--- a/lib/api/triggers.rb
+++ b/lib/api/triggers.rb
@@ -13,7 +13,7 @@ module API
optional :variables, type: Hash, desc: 'The list of variables to be injected into build'
end
post ":id/(ref/:ref/)trigger/builds" do
- project = Project.find_with_namespace(params[:id]) || Project.find_by(id: params[:id])
+ project = find_project(params[:id])
trigger = Ci::Trigger.find_by_token(params[:token].to_s)
not_found! unless project && trigger
unauthorized! unless trigger.project == project