summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfredo Sumaran <alfredo@gitlab.com>2016-08-21 00:19:22 -0500
committerAlfredo Sumaran <alfredo@gitlab.com>2016-08-21 00:19:22 -0500
commit18e98a364388e53786c7fe01eaff75efa496bb4c (patch)
tree8fd54eb6a34a4805a9f625174d3e31ad954eb979
parent54412dac15203b9208ca3ab56617262e7968050b (diff)
downloadgitlab-ce-18e98a364388e53786c7fe01eaff75efa496bb4c.tar.gz
Do not update if one dropdown has not selected any option
No need to update the branch permission if no option is marked on the dropdown
-rw-r--r--app/assets/javascripts/protected_branch_edit.js.es63
1 files changed, 3 insertions, 0 deletions
diff --git a/app/assets/javascripts/protected_branch_edit.js.es6 b/app/assets/javascripts/protected_branch_edit.js.es6
index a59fcbfa082..40bc4adb71b 100644
--- a/app/assets/javascripts/protected_branch_edit.js.es6
+++ b/app/assets/javascripts/protected_branch_edit.js.es6
@@ -31,6 +31,9 @@
const $allowedToMergeInput = this.$wrap.find(`input[name="${this.$allowedToMergeDropdown.data('fieldName')}"]`);
const $allowedToPushInput = this.$wrap.find(`input[name="${this.$allowedToPushDropdown.data('fieldName')}"]`);
+ // Do not update if one dropdown has not selected any option
+ if (!($allowedToMergeInput.length && $allowedToPushInput.length)) return;
+
$.ajax({
type: 'POST',
url: this.$wrap.data('url'),