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

  1. Create a new, blank project

  2. Add a new mirror repository (Settings > Repository > Mirroring repositories)

  3. Set the mirror to 'Pull' and ensure the 'Mirror only protected branches will be mirrored' radio button is checked:

    pull_mirror_all_protected_branches.jpg

  4. Delete the mirror, recreate it checking the 'Mirror all branches' radio button instead.

  5. You should see All branches label instead of All protected branches

Edited by Vasilii Iakliushin

Merge request reports

Loading