Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-02-24 12:14:06 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-02-24 12:14:06 +0300
commit563c8efdee39233f80f4dc7b20b38d417b26f055 (patch)
tree7b86eec1a8205b63c358f1004f20e5fbb52f1b4a /app/assets/javascripts/protected_branches
parent89bfc148f90c410512f9c470ca1e50485b7000b2 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/protected_branches')
-rw-r--r--app/assets/javascripts/protected_branches/protected_branch_edit.js48
1 files changed, 26 insertions, 22 deletions
diff --git a/app/assets/javascripts/protected_branches/protected_branch_edit.js b/app/assets/javascripts/protected_branches/protected_branch_edit.js
index 93eaebe2af3..15e706e38c6 100644
--- a/app/assets/javascripts/protected_branches/protected_branch_edit.js
+++ b/app/assets/javascripts/protected_branches/protected_branch_edit.js
@@ -31,36 +31,40 @@ export default class ProtectedBranchEdit {
const wrap = this.$wrap.get(0);
const forcePushToggle = initToggle(wrap.querySelector('.js-force-push-toggle'));
- forcePushToggle.$on('change', (value) => {
- forcePushToggle.isLoading = true;
- forcePushToggle.disabled = true;
- this.updateProtectedBranch(
- {
- allow_force_push: value,
- },
- () => {
- forcePushToggle.isLoading = false;
- forcePushToggle.disabled = false;
- },
- );
- });
-
- if (this.hasLicense) {
- const codeOwnerToggle = initToggle(wrap.querySelector('.js-code-owner-toggle'));
- codeOwnerToggle.$on('change', (value) => {
- codeOwnerToggle.isLoading = true;
- codeOwnerToggle.disabled = true;
+ if (forcePushToggle) {
+ forcePushToggle.$on('change', (value) => {
+ forcePushToggle.isLoading = true;
+ forcePushToggle.disabled = true;
this.updateProtectedBranch(
{
- code_owner_approval_required: value,
+ allow_force_push: value,
},
() => {
- codeOwnerToggle.isLoading = false;
- codeOwnerToggle.disabled = false;
+ forcePushToggle.isLoading = false;
+ forcePushToggle.disabled = false;
},
);
});
}
+
+ if (this.hasLicense) {
+ const codeOwnerToggle = initToggle(wrap.querySelector('.js-code-owner-toggle'));
+ if (codeOwnerToggle) {
+ codeOwnerToggle.$on('change', (value) => {
+ codeOwnerToggle.isLoading = true;
+ codeOwnerToggle.disabled = true;
+ this.updateProtectedBranch(
+ {
+ code_owner_approval_required: value,
+ },
+ () => {
+ codeOwnerToggle.isLoading = false;
+ codeOwnerToggle.disabled = false;
+ },
+ );
+ });
+ }
+ }
}
updateProtectedBranch(formData, callback) {