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,7 +5,8 @@ ...@@ -5,7 +5,8 @@
- 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?
#js-mr-approvals-input{ data: { 'project_id': @target_project.id,
'can_edit': can?(current_user, :update_approvers, issuable).to_s, 'can_edit': can?(current_user, :update_approvers, issuable).to_s,
'can_update_approvers': can_update_approvers.to_s, 'can_update_approvers': can_update_approvers.to_s,
'show_code_owner_tip': show_code_owner_tip.to_s, 'show_code_owner_tip': show_code_owner_tip.to_s,
...@@ -16,4 +17,4 @@ ...@@ -16,4 +17,4 @@
'eligible_approvers_docs_path': help_page_path('user/project/merge_requests/approvals/rules', anchor: 'eligible-approvers'), '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 } } 'project_settings_path': presenter.api_project_approval_settings_path } }
= sprite_icon('spinner', size: 24, css_class: 'gl-spinner gl-mt-5') = sprite_icon('spinner', size: 24, css_class: 'gl-spinner gl-mt-5')
= render 'projects/merge_requests/code_owner_approval_rules', merge_request: @mr_presenter = 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