Commit 9d048ea7 authored by rpereira2's avatar rpereira2

Send email if feature flag or license is disabled

- Send email if incident_management feature flag or license is disabled.
- A new issue will be created for checking the prometheus_alerts license
in the execute method of the NotifyService.
parent 6998c0b4
......@@ -25,8 +25,8 @@ module Projects
end
def send_email?
return firings.any? unless incident_management_feature_enabled?
return false unless has_incident_management_license?
return firings.any? unless incident_management_feature_enabled? &&
has_incident_management_license?
setting = project.incident_management_setting || project.build_incident_management_setting
......
......@@ -212,14 +212,7 @@ describe Projects::Prometheus::Alerts::NotifyService do
stub_licensed_features(incident_management: false)
end
it_behaves_like 'persists events'
it 'does not send notification' do
expect(project.feature_available?(:incident_management)).to eq(false)
expect(NotificationService).not_to receive(:new)
expect(subject).to eq(true)
end
it_behaves_like 'notifies alerts'
end
context 'with incident_management license' 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