Commit 40e31aa0 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'refactor-generic-alerts-endpoint' into 'master'

Fetch payload body from params[:notification]

See merge request gitlab-org/gitlab!17673
parents 71126a2f d70c5dc7
......@@ -20,8 +20,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]}")
......@@ -37,7 +35,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)
......@@ -46,8 +44,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
......
......@@ -18,8 +18,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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment