Fix incorrect pull mirror configuration after re-creation
What does this MR do and why?
Contributes to #500457 (closed)
Problem
When the user sets "Only protected branches" option and disables the
window, the state of "Only protected branches" is left as true.
If the user creates the pull mirror again and doesn't select a "Mirror
branches" option (leaves "Mirror all branches" by default), then "Only
protected branches" state stays true.
It happens because the frontend code doesn't clean it.
Solution
Add a handler on submit action to reset previous settings if "Mirror
all branches" option is set.
References
Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
-
Create a new, blank project
-
Add a new mirror repository (Settings > Repository > Mirroring repositories)
-
Set the mirror to 'Pull' and ensure the 'Mirror only protected branches will be mirrored' radio button is checked:
-
Delete the mirror, recreate it checking the 'Mirror all branches' radio button instead.
-
You should see
All brancheslabel instead ofAll protected branches
