Commit ce0f10f6 authored by Vladimir Shushlin's avatar Vladimir Shushlin

Fix MR approval by reporters

See
https://gitlab.com/gitlab-org/gitlab/-/issues/287795#note_591210032

It seems that requiring_code_owner_approval was added by mistake.

There were no such requirement in the original issue.

Changelog: fixed
EE: true
parent 66618af0
...@@ -16,7 +16,6 @@ module EE ...@@ -16,7 +16,6 @@ module EE
project = @subject.target_project project = @subject.target_project
protected_branch = project protected_branch = project
.protected_branches .protected_branches
.requiring_code_owner_approval
.find { |pb| pb.matches?(@subject.target_branch) } .find { |pb| pb.matches?(@subject.target_branch) }
protected_branch.present? && group_access?(protected_branch) protected_branch.present? && group_access?(protected_branch)
......
...@@ -138,7 +138,7 @@ RSpec.describe MergeRequestPolicy do ...@@ -138,7 +138,7 @@ RSpec.describe MergeRequestPolicy do
context 'for a merge request on a protected branch' do context 'for a merge request on a protected branch' do
let(:branch_name) { 'feature' } let(:branch_name) { 'feature' }
let_it_be(:user) { create :user } let_it_be(:user) { create :user }
let(:protected_branch) { create(:protected_branch, project: project, name: branch_name, code_owner_approval_required: true) } let(:protected_branch) { create(:protected_branch, project: project, name: branch_name) }
let_it_be(:approver_group) { create(:group) } let_it_be(:approver_group) { create(:group) }
let(:merge_request) { create(:merge_request, source_project: project, target_project: project, target_branch: branch_name) } let(:merge_request) { create(:merge_request, source_project: project, target_project: project, target_branch: branch_name) }
...@@ -195,7 +195,7 @@ RSpec.describe MergeRequestPolicy do ...@@ -195,7 +195,7 @@ RSpec.describe MergeRequestPolicy do
end end
context 'when the protected branch name is a wildcard' do context 'when the protected branch name is a wildcard' do
let(:wildcard_protected_branch) { create(:protected_branch, project: project, name: '*-stable', code_owner_approval_required: true) } let(:wildcard_protected_branch) { create(:protected_branch, project: project, name: '*-stable') }
before do before do
approval_project_rule.protected_branches << wildcard_protected_branch approval_project_rule.protected_branches << wildcard_protected_branch
......
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