Commit 1039b5b9 authored by Paul Slaughter's avatar Paul Slaughter

Fix approvals section when merge requests disabled

**Note:**
Previously, we simply hid the approvals section in the project edit.
This is consistent with the MR section, but it's problematic because
the approvals section uses ajax to load it's settings.
parent e51b3e49
- return unless @project.feature_available?(:merge_request_approvers)
- return unless @project.feature_available?(:merge_requests, current_user)
- return unless @project.feature_available?(:merge_request_approvers, current_user)
%section.settings.merge-requests-feature.no-animate#js-merge-request-approval-settings{ class: [('expanded' if expanded), ('hidden' if @project.project_feature.send(:merge_requests_access_level) == 0)] }
%section.settings.merge-requests-feature.no-animate#js-merge-request-approval-settings{ class: [('expanded' if expanded)] }
.settings-header
%h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only= _("Merge request approvals")
%button.btn.js-settings-toggle{ type: 'button' }= expanded ? _("Collapse") : _("Expand")
......
---
title: Fix approvals project settings section when merge requests disabled
merge_request: 12070
author:
type: fixed
......@@ -4,13 +4,34 @@ describe 'EE > Projects > Settings > User manages approval rule settings' do
let(:project) { create(:project) }
let(:user) { project.owner }
let(:path) { edit_project_path(project) }
let(:licensed_features) { {} }
let(:project_features) { {} }
before do
sign_in(user)
stub_licensed_features(licensed_features)
project.project_feature.update(project_features)
visit path
end
context 'when merge requests is not available' do
let(:project_features) { { merge_requests_access_level: ::ProjectFeature::DISABLED } }
it 'does not show approval settings' do
expect(page).not_to have_selector('#js-merge-request-approval-settings')
end
end
context 'when merge requests is available' do
let(:project_features) { { merge_requests_access_level: ::ProjectFeature::ENABLED } }
it 'shows approval settings' do
expect(page).to have_selector('#js-merge-request-approval-settings')
end
end
context 'when `code_owner_approval_required` is available' do
let(:licensed_features) { { code_owner_approval_required: true } }
......
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