Commit 0af68a71 authored by Jiaan Louw's avatar Jiaan Louw Committed by Natalia Tepluhina

Fix approvals UI rendering when feature is disabled

parent c28746bc
...@@ -5,15 +5,16 @@ ...@@ -5,15 +5,16 @@
- approver_presenter = MergeRequestApproverPresenter.new(issuable, skip_user: current_user) - approver_presenter = MergeRequestApproverPresenter.new(issuable, skip_user: current_user)
- show_code_owner_tip = approver_presenter.show_code_owner_tips? - show_code_owner_tip = approver_presenter.show_code_owner_tips?
#js-mr-approvals-input{ data: { 'project_id': @target_project.id, - if presenter.approval_feature_available?
'can_edit': can?(current_user, :update_approvers, issuable).to_s, #js-mr-approvals-input{ data: { 'project_id': @target_project.id,
'can_update_approvers': can_update_approvers.to_s, 'can_edit': can?(current_user, :update_approvers, issuable).to_s,
'show_code_owner_tip': show_code_owner_tip.to_s, 'can_update_approvers': can_update_approvers.to_s,
'allow_multi_rule': @target_project.multiple_approval_rules_available?.to_s, 'show_code_owner_tip': show_code_owner_tip.to_s,
'can-override': @target_project.can_override_approvers?.to_s, 'allow_multi_rule': @target_project.multiple_approval_rules_available?.to_s,
'mr_id': issuable.iid, 'can-override': @target_project.can_override_approvers?.to_s,
'mr_settings_path': presenter.api_approval_settings_path, 'mr_id': issuable.iid,
'eligible_approvers_docs_path': help_page_path('user/project/merge_requests/approvals/rules', anchor: 'eligible-approvers'), 'mr_settings_path': presenter.api_approval_settings_path,
'project_settings_path': presenter.api_project_approval_settings_path } } 'eligible_approvers_docs_path': help_page_path('user/project/merge_requests/approvals/rules', anchor: 'eligible-approvers'),
= sprite_icon('spinner', size: 24, css_class: 'gl-spinner gl-mt-5') 'project_settings_path': presenter.api_project_approval_settings_path } }
= render 'projects/merge_requests/code_owner_approval_rules', merge_request: @mr_presenter = 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 ...@@ -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) expect(page).to have_selector('.select2-result-label .group-result', text: group.name)
end end
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 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