Commit f6b9b770 authored by Sarah Yasonik's avatar Sarah Yasonik Committed by Douglas Barbosa Alexandre

Allow alert incident title to include iid for HTTP integrations

parent f64a7c35
...@@ -262,7 +262,6 @@ module EE ...@@ -262,7 +262,6 @@ module EE
def generic_alert_with_default_title? def generic_alert_with_default_title?
title == ::Gitlab::AlertManagement::Payload::Generic::DEFAULT_TITLE && title == ::Gitlab::AlertManagement::Payload::Generic::DEFAULT_TITLE &&
project.alerts_service_activated? &&
author == ::User.alert_bot author == ::User.alert_bot
end end
......
---
title: Include issue iid in default title for untitled incidents when created from
alert via HTTP integration
merge_request: 49274
author:
type: fixed
...@@ -30,30 +30,14 @@ RSpec.describe Issue do ...@@ -30,30 +30,14 @@ RSpec.describe Issue do
context 'when issue title is "New: Incident"' do context 'when issue title is "New: Incident"' do
let(:issue) { build(:issue, project: project, author: author, title: 'New: Incident', iid: 503503) } let(:issue) { build(:issue, project: project, author: author, title: 'New: Incident', iid: 503503) }
context 'when alerts service is active' do context 'when the author is Alert Bot' do
before do it 'updates issue title with the IID' do
allow(project).to receive(:alerts_service_activated?).and_return(true) expect { issue.save }.to change { issue.title }.to("New: Incident 503503")
end
context 'when the author is Alert Bot' do
it 'updates issue title with the IID' do
expect { issue.save }.to change { issue.title }.to("New: Incident 503503")
end
end
context 'when the author is not an Alert Bot' do
let(:author) { create(:user) }
it 'does not change issue title' do
expect { issue.save }.not_to change { issue.title }
end
end end
end end
context 'when alerts service is not active' do context 'when the author is not an Alert Bot' do
before do let(:author) { create(:user) }
allow(project).to receive(:alerts_service_activated?).and_return(false)
end
it 'does not change issue title' do it 'does not change issue title' do
expect { issue.save }.not_to change { issue.title } expect { issue.save }.not_to change { issue.title }
......
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