Commit 1047ae11 authored by Ash McKenzie's avatar Ash McKenzie

Merge branch...

Merge branch '229739-regression-alerts-without-fingerprint-cannot-be-moved-back-to-open-state' into 'master'

Fix Regression: Alerts without fingerprint cannot be moved back to open state

Closes #229739

See merge request gitlab-org/gitlab!37159
parents 89fae089 1cc2ff17
...@@ -150,6 +150,8 @@ module AlertManagement ...@@ -150,6 +150,8 @@ module AlertManagement
end end
def duplicate_alert? def duplicate_alert?
return if alert.fingerprint.blank?
open_alerts.any? && open_alerts.exclude?(alert) open_alerts.any? && open_alerts.exclude?(alert)
end end
......
...@@ -209,6 +209,19 @@ RSpec.describe AlertManagement::Alerts::UpdateService do ...@@ -209,6 +209,19 @@ RSpec.describe AlertManagement::Alerts::UpdateService do
expect(response).to be_error expect(response).to be_error
expect(response.message).to eq(message) expect(response.message).to eq(message)
end end
context 'fingerprints are blank' do
let_it_be(:alert) { create(:alert_management_alert, :resolved, project: project, fingerprint: nil) }
let_it_be(:existing_alert) { create(:alert_management_alert, :triggered, fingerprint: alert.fingerprint, project: project) }
it 'successfully changes the status' do
expect { response }.to change { alert.acknowledged? }.to(true)
expect(response).to be_success
expect(response.payload[:alert]).to eq(alert)
end
it_behaves_like 'adds a system note'
end
end end
context 'two existing closed alerts' do context 'two existing closed alerts' 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