Commit dc0fde51 authored by Vitali Tatarintev's avatar Vitali Tatarintev

Allow to update auto_close_incident checkbox

Hook up the auto_close_incident checkbox with the corresponding
DB column
parent 8be2fedb
...@@ -43,7 +43,7 @@ module OperationsHelper ...@@ -43,7 +43,7 @@ module OperationsHelper
create_issue: setting.create_issue.to_s, create_issue: setting.create_issue.to_s,
issue_template_key: setting.issue_template_key.to_s, issue_template_key: setting.issue_template_key.to_s,
send_email: setting.send_email.to_s, send_email: setting.send_email.to_s,
auto_close_incident: 'true', auto_close_incident: setting.auto_close_incident.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_integrations_pagerduty_url(@project, token: setting.pagerduty_token), pagerduty_webhook_url: project_incidents_integrations_pagerduty_url(@project, token: setting.pagerduty_token),
......
...@@ -35,6 +35,9 @@ module Gitlab ...@@ -35,6 +35,9 @@ module Gitlab
}, },
pagerduty_active: { pagerduty_active: {
name: 'pagerduty_webhook' name: 'pagerduty_webhook'
},
auto_close_incident: {
name: 'auto_close_incident'
} }
}.with_indifferent_access.freeze }.with_indifferent_access.freeze
end end
......
...@@ -152,7 +152,8 @@ RSpec.describe Projects::Settings::OperationsController do ...@@ -152,7 +152,8 @@ RSpec.describe Projects::Settings::OperationsController do
create_issue: 'false', create_issue: 'false',
send_email: 'false', send_email: 'false',
issue_template_key: 'some-other-template', issue_template_key: 'some-other-template',
pagerduty_active: 'true' pagerduty_active: 'true',
auto_close_incident: 'true'
} }
} }
end end
...@@ -187,6 +188,8 @@ RSpec.describe Projects::Settings::OperationsController do ...@@ -187,6 +188,8 @@ RSpec.describe Projects::Settings::OperationsController do
it_behaves_like 'a gitlab tracking event', { send_email: '0' }, 'disabled_sending_emails' it_behaves_like 'a gitlab tracking event', { send_email: '0' }, 'disabled_sending_emails'
it_behaves_like 'a gitlab tracking event', { pagerduty_active: '1' }, 'enabled_pagerduty_webhook' it_behaves_like 'a gitlab tracking event', { pagerduty_active: '1' }, 'enabled_pagerduty_webhook'
it_behaves_like 'a gitlab tracking event', { pagerduty_active: '0' }, 'disabled_pagerduty_webhook' it_behaves_like 'a gitlab tracking event', { pagerduty_active: '0' }, 'disabled_pagerduty_webhook'
it_behaves_like 'a gitlab tracking event', { auto_close_incident: '1' }, 'enabled_auto_close_incident'
it_behaves_like 'a gitlab tracking event', { auto_close_incident: '0' }, 'disabled_auto_close_incident'
end end
end end
......
...@@ -137,7 +137,8 @@ RSpec.describe OperationsHelper do ...@@ -137,7 +137,8 @@ RSpec.describe OperationsHelper do
:project_incident_management_setting, :project_incident_management_setting,
project: project, project: project,
issue_template_key: 'template-key', issue_template_key: 'template-key',
pagerduty_active: true pagerduty_active: true,
auto_close_incident: false
) )
end end
...@@ -150,7 +151,7 @@ RSpec.describe OperationsHelper do ...@@ -150,7 +151,7 @@ RSpec.describe OperationsHelper do
create_issue: 'false', create_issue: 'false',
issue_template_key: 'template-key', issue_template_key: 'template-key',
send_email: 'false', send_email: 'false',
auto_close_incident: 'true', auto_close_incident: 'false',
pagerduty_active: 'true', pagerduty_active: 'true',
pagerduty_token: operations_settings.pagerduty_token, pagerduty_token: operations_settings.pagerduty_token,
pagerduty_webhook_url: project_incidents_integrations_pagerduty_url(project, token: operations_settings.pagerduty_token), pagerduty_webhook_url: project_incidents_integrations_pagerduty_url(project, token: operations_settings.pagerduty_token),
......
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