Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
304163be
Commit
304163be
authored
Nov 24, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API: Use `#find_project` in API::Triggers and API::Services
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
4d2e7894
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
lib/api/services.rb
lib/api/services.rb
+1
-1
lib/api/triggers.rb
lib/api/triggers.rb
+1
-1
No files found.
lib/api/services.rb
View file @
304163be
...
@@ -65,7 +65,7 @@ module API
...
@@ -65,7 +65,7 @@ module API
detail
'Added in GitLab 8.13'
detail
'Added in GitLab 8.13'
end
end
post
':id/services/:service_slug/trigger'
do
post
':id/services/:service_slug/trigger'
do
project
=
Project
.
find_with_namespace
(
params
[
:id
])
||
Project
.
find_by
(
id:
params
[
:id
])
project
=
find_project
(
params
[
:id
])
# This is not accurate, but done to prevent leakage of the project names
# This is not accurate, but done to prevent leakage of the project names
not_found!
(
'Service'
)
unless
project
not_found!
(
'Service'
)
unless
project
...
...
lib/api/triggers.rb
View file @
304163be
...
@@ -13,7 +13,7 @@ module API
...
@@ -13,7 +13,7 @@ module API
optional
:variables
,
type:
Hash
,
desc:
'The list of variables to be injected into build'
optional
:variables
,
type:
Hash
,
desc:
'The list of variables to be injected into build'
end
end
post
":id/(ref/:ref/)trigger/builds"
do
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
)
trigger
=
Ci
::
Trigger
.
find_by_token
(
params
[
:token
].
to_s
)
not_found!
unless
project
&&
trigger
not_found!
unless
project
&&
trigger
unauthorized!
unless
trigger
.
project
==
project
unauthorized!
unless
trigger
.
project
==
project
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment