diff options
author | Fatih Acet <acetfatih@gmail.com> | 2017-05-26 19:42:02 +0000 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2017-05-26 19:42:02 +0000 |
commit | 8968171c9e58708f6f0922a1a337bb622bd8b9b5 (patch) | |
tree | a9630f0e3634a976f6493558e9b1645624c544cb /app/assets | |
parent | 3605e4307ddf373071c0353a066c50fcead01e45 (diff) | |
parent | 099a9e016e8c09609fbbbc96c6bca4781f87d487 (diff) | |
download | gitlab-ce-8968171c9e58708f6f0922a1a337bb622bd8b9b5.tar.gz |
Merge branch '32447-remove-source-branch-is-displayed-to-mergers-who-cannot-actually-delete-the-source-branch-from-a-forked-project' into 'master'
Disable "Remove source branch" in MR Widget for users who can't remove, and re-add checkbox to MR form
Closes #32447 and #32907
See merge request !11558
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_ready_to_merge.js | 8 | ||||
-rw-r--r-- | app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_ready_to_merge.js b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_ready_to_merge.js index d866d4e94b0..fcd4fdaf09f 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_ready_to_merge.js +++ b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_ready_to_merge.js @@ -13,7 +13,7 @@ export default { }, data() { return { - removeSourceBranch: true, + removeSourceBranch: this.mr.shouldRemoveSourceBranch, mergeWhenBuildSucceeds: false, useCommitMessageWithDescription: false, setToMergeWhenPipelineSucceeds: false, @@ -69,6 +69,9 @@ export default { || this.isMakingRequest || this.mr.preventMerge); }, + isRemoveSourceBranchButtonDisabled() { + return this.isMergeButtonDisabled || !this.mr.canRemoveSourceBranch; + }, shouldShowSquashBeforeMerge() { const { commitsCount, enableSquashBeforeMerge } = this.mr; return enableSquashBeforeMerge && commitsCount > 1; @@ -252,8 +255,9 @@ export default { <template v-if="isMergeAllowed()"> <label class="spacing"> <input + id="remove-source-branch-input" v-model="removeSourceBranch" - :disabled="isMergeButtonDisabled" + :disabled="isRemoveSourceBranchButtonDisabled" type="checkbox"/> Remove source branch </label> diff --git a/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js b/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js index c07bd25e6fd..dc4b2195050 100644 --- a/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js +++ b/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js @@ -50,7 +50,7 @@ export default class MergeRequestStore { this.cancelAutoMergePath = data.cancel_merge_when_pipeline_succeeds_path; this.removeWIPPath = data.remove_wip_path; this.sourceBranchRemoved = !data.source_branch_exists; - this.shouldRemoveSourceBranch = (data.merge_params || {}).should_remove_source_branch || false; + this.shouldRemoveSourceBranch = data.remove_source_branch || false; this.onlyAllowMergeIfPipelineSucceeds = data.only_allow_merge_if_pipeline_succeeds || false; this.mergeWhenPipelineSucceeds = data.merge_when_pipeline_succeeds || false; this.mergePath = data.merge_path; |