diff --git a/ee/app/controllers/projects/alerting/notifications_controller.rb b/ee/app/controllers/projects/alerting/notifications_controller.rb index 9aeda63034201986b4392e2d76659e17c958b385..e7240f61aecbe5074ad00b7c6c0e83d5ea0c945e 100644 --- a/ee/app/controllers/projects/alerting/notifications_controller.rb +++ b/ee/app/controllers/projects/alerting/notifications_controller.rb @@ -19,8 +19,6 @@ module Projects private - PARAMS_TO_EXCLUDE = %w(controller action namespace_id project_id).freeze - def project_without_auth @project ||= Project .find_by_full_path("#{params[:namespace_id]}/#{params[:project_id]}") @@ -36,7 +34,7 @@ module Projects def notify_service Projects::Alerting::NotifyService - .new(project, current_user, permitted_params) + .new(project, current_user, notification_payload) end def response_status(result) @@ -45,8 +43,8 @@ module Projects result.http_status end - def permitted_params - params.except(*PARAMS_TO_EXCLUDE).permit! + def notification_payload + params.permit![:notification] end end end diff --git a/ee/spec/controllers/projects/alerting/notifications_controller_spec.rb b/ee/spec/controllers/projects/alerting/notifications_controller_spec.rb index 3205ae1877d155de17e2da92c65820a54a3d2a67..0f7d26993fb1a8bae44ba805861e3b931b16a40a 100644 --- a/ee/spec/controllers/projects/alerting/notifications_controller_spec.rb +++ b/ee/spec/controllers/projects/alerting/notifications_controller_spec.rb @@ -14,8 +14,8 @@ describe Projects::Alerting::NotificationsController do allow(Projects::Alerting::NotifyService).to receive(:new).and_return(notify_service) end - def make_request(opts = {}) - post :create, params: project_params(opts), session: { as: :json } + def make_request(body = {}) + post :create, params: project_params, body: body.to_json, as: :json end context 'when feature flag is on' do