Commit cdafefac authored by Phil Hughes's avatar Phil Hughes

Fixes approval rules not loading correctly for forks

This fixes a bug where approval rules for merge requests would
load the wrong set of rules for forks would send the incorrect
branch name and would load the wrong approval rules for the
selected target branch.

Closes https://gitlab.com/gitlab-org/gitlab/-/issues/339918
parent 6fc25516
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
= html_escape(_('From %{code_open}%{source_title}%{code_close} into')) % { source_title: source_title, code_open: '<code>'.html_safe, code_close: '</code>'.html_safe } = html_escape(_('From %{code_open}%{source_title}%{code_close} into')) % { source_title: source_title, code_open: '<code>'.html_safe, code_close: '</code>'.html_safe }
- if issuable.new_record? - if issuable.new_record?
%code#js-target-branch-title= target_title %code#js-target-branch-title{ data: { branch_name: @merge_request.target_branch } }= target_title
&nbsp; &nbsp;
= link_to _('Change branches'), mr_change_branches_path(issuable) = link_to _('Change branches'), mr_change_branches_path(issuable)
- elsif issuable.for_fork? - elsif issuable.for_fork?
......
...@@ -9,8 +9,10 @@ export default function mountApprovalInput(el) { ...@@ -9,8 +9,10 @@ export default function mountApprovalInput(el) {
return null; return null;
} }
const targetBranchTitle = document.querySelector('#js-target-branch-title');
const targetBranch = const targetBranch =
document.querySelector('#js-target-branch-title')?.textContent || targetBranchTitle?.dataset?.branchName ||
targetBranchTitle?.textContent ||
document.querySelector('#merge_request_target_branch')?.value; document.querySelector('#merge_request_target_branch')?.value;
const store = createStore( const store = createStore(
......
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