Commit d9bdf62b authored by Etienne Baqué's avatar Etienne Baqué

Merge branch 'sy-fix-page-quick-action-availability' into 'master'

Limit availability of page quick action to relevant incidents

See merge request gitlab-org/gitlab!82355
parents 3e3af288 e412c034
......@@ -179,7 +179,8 @@ module EE
condition do
current_user.can?(:update_escalation_status, quick_action_target) &&
quick_action_target.persisted? &&
quick_action_target.supports_escalation?
quick_action_target.escalation_policies_available? &&
!quick_action_target.alert_management_alert
end
command :page do |escalation_policy_name|
......
......@@ -11,10 +11,9 @@ RSpec.shared_examples 'page quick action' do
let_it_be(:incident, reload: true) { create(:incident, project: project) }
let_it_be(:escalation_status, reload: true) { create(:incident_management_issuable_escalation_status, issue: incident) }
context 'when feature flags and licenses are disabled' do
context 'when feature flag is disabled' do
before do
stub_feature_flags(incident_escalations: false)
stub_licensed_features(oncall_schedules: false, escalation_policies: false)
visit project_issue_path(project, incident)
wait_for_all_requests
end
......@@ -26,9 +25,21 @@ RSpec.shared_examples 'page quick action' do
end
end
context 'when feature flags and licenses are enabled' do
context 'when licensed features are disabled' do
before do
visit project_issue_path(project, incident)
wait_for_all_requests
end
it 'does not escalate issue' do
add_note('/page spec policy')
expect(page).to have_content('Could not apply page command')
end
end
context 'when licensed features are enabled' do
before do
stub_feature_flags(incident_escalations: true)
stub_licensed_features(oncall_schedules: true, escalation_policies: true)
end
......@@ -65,6 +76,16 @@ RSpec.shared_examples 'page quick action' do
end
end
context 'when issue already has an alert' do
let_it_be(:alert) { create(:alert_management_alert, issue: incident) }
it 'does not escalate issue' do
add_note('/page spec policy')
expect(page).to have_content('Could not apply page command')
end
end
context 'when user does not have permissions' do
before do
project.add_reporter(user)
......
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