Commit 93d73652 authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch '337651-only-render-mr-approvals-when-enabled' into 'master'

Fix approvals UI rendering when feature is disabled

See merge request gitlab-org/gitlab!68455
parents 5ec0a9ee 0af68a71
......@@ -5,15 +5,16 @@
- approver_presenter = MergeRequestApproverPresenter.new(issuable, skip_user: current_user)
- show_code_owner_tip = approver_presenter.show_code_owner_tips?
#js-mr-approvals-input{ data: { 'project_id': @target_project.id,
'can_edit': can?(current_user, :update_approvers, issuable).to_s,
'can_update_approvers': can_update_approvers.to_s,
'show_code_owner_tip': show_code_owner_tip.to_s,
'allow_multi_rule': @target_project.multiple_approval_rules_available?.to_s,
'can-override': @target_project.can_override_approvers?.to_s,
'mr_id': issuable.iid,
'mr_settings_path': presenter.api_approval_settings_path,
'eligible_approvers_docs_path': help_page_path('user/project/merge_requests/approvals/rules', anchor: 'eligible-approvers'),
'project_settings_path': presenter.api_project_approval_settings_path } }
= sprite_icon('spinner', size: 24, css_class: 'gl-spinner gl-mt-5')
= render 'projects/merge_requests/code_owner_approval_rules', merge_request: @mr_presenter
- if presenter.approval_feature_available?
#js-mr-approvals-input{ data: { 'project_id': @target_project.id,
'can_edit': can?(current_user, :update_approvers, issuable).to_s,
'can_update_approvers': can_update_approvers.to_s,
'show_code_owner_tip': show_code_owner_tip.to_s,
'allow_multi_rule': @target_project.multiple_approval_rules_available?.to_s,
'can-override': @target_project.can_override_approvers?.to_s,
'mr_id': issuable.iid,
'mr_settings_path': presenter.api_approval_settings_path,
'eligible_approvers_docs_path': help_page_path('user/project/merge_requests/approvals/rules', anchor: 'eligible-approvers'),
'project_settings_path': presenter.api_project_approval_settings_path } }
= sprite_icon('spinner', size: 24, css_class: 'gl-spinner gl-mt-5')
= render 'projects/merge_requests/code_owner_approval_rules', merge_request: @mr_presenter
......@@ -128,4 +128,16 @@ RSpec.describe 'Merge request > User edits MR with approval rules', :js do
expect(page).to have_selector('.select2-result-label .group-result', text: group.name)
end
end
context 'feature is disabled' do
before do
stub_licensed_features(merge_request_approvers: false)
visit(edit_project_merge_request_path(project, merge_request))
end
it 'cannot see the approval rules input' do
expect(page).not_to have_content('Approval rules')
end
end
end
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