From 4e9acbfba3682c552b3de707c535e6257ef41054 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 30 Mar 2020 15:07:51 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- app/assets/javascripts/mirrors/mirror_repos.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'app/assets/javascripts/mirrors') diff --git a/app/assets/javascripts/mirrors/mirror_repos.js b/app/assets/javascripts/mirrors/mirror_repos.js index e5acaaf9366..5401fb7b6ec 100644 --- a/app/assets/javascripts/mirrors/mirror_repos.js +++ b/app/assets/javascripts/mirrors/mirror_repos.js @@ -22,15 +22,18 @@ export default class MirrorRepos { } initMirrorPush() { + this.$keepDivergentRefsInput = $('.js-mirror-keep-divergent-refs', this.$form); this.$passwordGroup = $('.js-password-group', this.$container); this.$password = $('.js-password', this.$passwordGroup); this.$authMethod = $('.js-auth-method', this.$form); + this.$keepDivergentRefsInput.on('change', () => this.updateKeepDivergentRefs()); this.$authMethod.on('change', () => this.togglePassword()); this.$password.on('input.updateUrl', () => this.debouncedUpdateUrl()); this.initMirrorSSH(); this.updateProtectedBranches(); + this.updateKeepDivergentRefs(); } initMirrorSSH() { @@ -61,6 +64,16 @@ export default class MirrorRepos { $('.js-mirror-protected-hidden', this.$form).val(val); } + updateKeepDivergentRefs() { + const field = this.$keepDivergentRefsInput.get(0); + + // This field only exists after the form is switched to 'Push' mode + if (field) { + const val = field.checked ? this.$keepDivergentRefsInput.val() : '0'; + $('.js-mirror-keep-divergent-refs-hidden', this.$form).val(val); + } + } + registerUpdateListeners() { this.debouncedUpdateUrl = debounce(() => this.updateUrl(), 200); this.$urlInput.on('input', () => this.debouncedUpdateUrl()); -- cgit v1.2.3