diff options
author | Felipe Artur <felipefac@gmail.com> | 2016-07-06 23:52:00 +0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2016-07-20 02:57:59 +0300 |
commit | 8bd520d70e035cd67d19b7962911ae9c31d1ff3d (patch) | |
tree | dd3e8bf4925f36758825879857a54b7d5e94a638 /app/controllers | |
parent | b9ed9d658ad447a64d58b2040849a7cc0e698287 (diff) |
Allow slack service to send messages on different channels
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/admin/services_controller.rb | 7 | ||||
-rw-r--r-- | app/controllers/projects/services_controller.rb | 7 |
2 files changed, 11 insertions, 3 deletions
diff --git a/app/controllers/admin/services_controller.rb b/app/controllers/admin/services_controller.rb index 46133588332..40938986a92 100644 --- a/app/controllers/admin/services_controller.rb +++ b/app/controllers/admin/services_controller.rb @@ -39,11 +39,14 @@ class Admin::ServicesController < Admin::ApplicationController end def application_services_params + dynamic_params = [] + dynamic_params.concat(@service.event_channel_names) if @service.is_a?(SlackService) + application_services_params = params.permit(:id, - service: Projects::ServicesController::ALLOWED_PARAMS) + service: Projects::ServicesController::ALLOWED_PARAMS + dynamic_params) if application_services_params[:service].is_a?(Hash) Projects::ServicesController::FILTER_BLANK_PARAMS.each do |param| - application_services_params[:service].delete(param) if application_services_params[:service][param].blank? + application_services_params[:service].delete(param) if application_services_params[:service][param].blank? end end application_services_params diff --git a/app/controllers/projects/services_controller.rb b/app/controllers/projects/services_controller.rb index 1b91882048e..80553e035f0 100644 --- a/app/controllers/projects/services_controller.rb +++ b/app/controllers/projects/services_controller.rb @@ -66,10 +66,15 @@ class Projects::ServicesController < Projects::ApplicationController end def service_params - service_params = params.require(:service).permit(ALLOWED_PARAMS) + dynamic_params = [] + dynamic_params.concat(@service.event_channel_names) if @service.is_a?(SlackService) + + service_params = params.require(:service).permit(ALLOWED_PARAMS + dynamic_params) + FILTER_BLANK_PARAMS.each do |param| service_params.delete(param) if service_params[param].blank? end + service_params end end |