diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-02-02 11:54:35 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-02-02 11:54:35 +0800 |
commit | 54fca95160389fe7993df5d82635b83804833fee (patch) | |
tree | 8552f29a7bfbf24af39a5d6a3f8b110c1695f7de /lib/api | |
parent | eb242fc865c032f6408f3b68700da9b840b416dd (diff) | |
parent | 40a824357c700280f3d2f8e2cda2fabc65af7f69 (diff) | |
download | gitlab-ce-54fca95160389fe7993df5d82635b83804833fee.tar.gz |
Merge remote-tracking branch 'upstream/master' into fix-git-hooks-when-creating-filefix-git-hooks-when-creating-file
* upstream/master: (190 commits)
Remove unnecessary returns / unset variables from the CoffeeScript -> JS conversion.
update spec
Change the reply shortcut to focus the field even without a selection.
use destroy_all
Remove settings cog from within admin scroll tabs; keep links centered
add changelog
remove old project members from project
add spec replicating validation error
Fix small typo on new branch button spec
Improve styling of the new issue message
Don't capitalize environment name in show page
Abillity to promote project labels to group labels
Edited the column header for the environments list from created to updated and added created to environments detail page colum header titles
Update and pin the `jwt` gem to ~> 1.5.6
refactor merge request build service
Update index.md
Clarify that Auto Deploy requires a public project.
19164 Add settings dropdown to mobile screens
cop for gem fetched from a git source
Add CHANGELOG entry
...
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/entities.rb | 1 | ||||
-rw-r--r-- | lib/api/services.rb | 13 |
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 9f59939e9ae..a07b2a9ca0f 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -137,6 +137,7 @@ module API expose :avatar_url expose :web_url expose :request_access_enabled + expose :full_name, :full_path expose :statistics, if: :statistics do with_options format_with: -> (value) { value.to_i } do diff --git a/lib/api/services.rb b/lib/api/services.rb index a0abec49438..1456fe4688b 100644 --- a/lib/api/services.rb +++ b/lib/api/services.rb @@ -661,6 +661,14 @@ module API end trigger_services.each do |service_slug, settings| + helpers do + def chat_command_service(project, service_slug, params) + project.services.active.where(template: false).find do |service| + service.try(:token) == params[:token] && service.to_param == service_slug.underscore + end + end + end + params do requires :id, type: String, desc: 'The ID of a project' end @@ -679,9 +687,8 @@ module API # This is not accurate, but done to prevent leakage of the project names not_found!('Service') unless project - service = project.find_or_initialize_service(service_slug.underscore) - - result = service.try(:active?) && service.try(:trigger, params) + service = chat_command_service(project, service_slug, params) + result = service.try(:trigger, params) if result status result[:status] || 200 |