Commit cec750cb authored by Vitali Tatarintev's avatar Vitali Tatarintev

Rename PagerDuty webhook URL

Rename PagerDuty webhook URL to /incindents/pagerduty
parent 3e841cdd
...@@ -47,10 +47,10 @@ module Projects ...@@ -47,10 +47,10 @@ module Projects
.new(project, current_user, pagerduty_token_params) .new(project, current_user, pagerduty_token_params)
.execute .execute
pagerduty_token = project.incident_management_setting&.pagerduty_token
webhook_url = project_incidents_pager_duty_url(project, token: pagerduty_token)
if result[:status] == :success if result[:status] == :success
pagerduty_token = project.incident_management_setting&.pagerduty_token
webhook_url = project_incidents_pagerduty_url(project, token: pagerduty_token)
render json: { pagerduty_webhook_url: webhook_url, pagerduty_token: pagerduty_token } render json: { pagerduty_webhook_url: webhook_url, pagerduty_token: pagerduty_token }
else else
render json: {}, status: :unprocessable_entity render json: {}, status: :unprocessable_entity
......
...@@ -45,7 +45,7 @@ module OperationsHelper ...@@ -45,7 +45,7 @@ module OperationsHelper
send_email: setting.send_email.to_s, send_email: setting.send_email.to_s,
pagerduty_active: setting.pagerduty_active.to_s, pagerduty_active: setting.pagerduty_active.to_s,
pagerduty_token: setting.pagerduty_token.to_s, pagerduty_token: setting.pagerduty_token.to_s,
pagerduty_webhook_url: project_incidents_pager_duty_url(@project, token: setting.pagerduty_token), pagerduty_webhook_url: project_incidents_pagerduty_url(@project, token: setting.pagerduty_token),
pagerduty_reset_key_path: reset_pagerduty_token_project_settings_operations_path(@project) pagerduty_reset_key_path: reset_pagerduty_token_project_settings_operations_path(@project)
} }
end end
......
...@@ -407,7 +407,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do ...@@ -407,7 +407,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
post 'alerts/notify', to: 'alerting/notifications#create' post 'alerts/notify', to: 'alerting/notifications#create'
post 'incidents/pager_duty', to: 'incident_management/pager_duty_incidents#create' post 'incidents/pagerduty', to: 'incident_management/pager_duty_incidents#create'
draw :legacy_builds draw :legacy_builds
......
...@@ -203,7 +203,7 @@ RSpec.describe Projects::Settings::OperationsController do ...@@ -203,7 +203,7 @@ RSpec.describe Projects::Settings::OperationsController do
reset_pagerduty_token reset_pagerduty_token
new_token = incident_management_setting.reload.pagerduty_token new_token = incident_management_setting.reload.pagerduty_token
new_webhook_url = project_incidents_pager_duty_url(project, token: new_token) new_webhook_url = project_incidents_pagerduty_url(project, token: new_token)
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(json_response['pagerduty_webhook_url']).to eq(new_webhook_url) expect(json_response['pagerduty_webhook_url']).to eq(new_webhook_url)
...@@ -216,7 +216,7 @@ RSpec.describe Projects::Settings::OperationsController do ...@@ -216,7 +216,7 @@ RSpec.describe Projects::Settings::OperationsController do
it 'does not reset a token' do it 'does not reset a token' do
reset_pagerduty_token reset_pagerduty_token
new_webhook_url = project_incidents_pager_duty_url(project, token: nil) new_webhook_url = project_incidents_pagerduty_url(project, token: nil)
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(json_response['pagerduty_webhook_url']).to eq(new_webhook_url) expect(json_response['pagerduty_webhook_url']).to eq(new_webhook_url)
......
...@@ -152,7 +152,7 @@ RSpec.describe OperationsHelper do ...@@ -152,7 +152,7 @@ RSpec.describe OperationsHelper do
send_email: 'false', send_email: 'false',
pagerduty_active: 'true', pagerduty_active: 'true',
pagerduty_token: operations_settings.pagerduty_token, pagerduty_token: operations_settings.pagerduty_token,
pagerduty_webhook_url: project_incidents_pager_duty_url(project, token: operations_settings.pagerduty_token), pagerduty_webhook_url: project_incidents_pagerduty_url(project, token: operations_settings.pagerduty_token),
pagerduty_reset_key_path: reset_pagerduty_token_project_settings_operations_path(project) pagerduty_reset_key_path: reset_pagerduty_token_project_settings_operations_path(project)
) )
end end
......
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