Commit bc2b3171 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch '11321-fix-approvals-fetching-when-merge-requests-disabled' into 'master'

Fix approvals section when merge requests disabled

Closes #11321

See merge request gitlab-org/gitlab-ee!12070
parents 46790d6c 1039b5b9
- 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