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
path: root/app
diff options
context:
space:
mode:
authorAndré Luís <aluis@gitlab.com>2018-10-11 19:49:45 +0300
committerAndré Luís <aluis@gitlab.com>2018-10-12 01:49:52 +0300
commitcbb659cdb340176c4359ab0ee79e9d03782e00e9 (patch)
tree2ffb91e51c0efa3b316e197b657acbfb6ab42468 /app
parente5ae0be4381e7ca9a0e226a75132fb77916648a1 (diff)
Backport EE fixes to CE checking resolvability
EE branch: 7921-fix-batch-comments-resolution fixes the checks to know whether discussion will be resolved upon posting a comment or not. It covers scenarios where Batch Comments are enabled and disabled. To minimise risk of conflicts between CE and EE, the checks have been backported. this.shouldResolve() will not exist in CE.
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/notes/components/note_form.vue14
1 files changed, 13 insertions, 1 deletions
diff --git a/app/assets/javascripts/notes/components/note_form.vue b/app/assets/javascripts/notes/components/note_form.vue
index 33998394a69..38c43e5fe08 100644
--- a/app/assets/javascripts/notes/components/note_form.vue
+++ b/app/assets/javascripts/notes/components/note_form.vue
@@ -102,6 +102,18 @@ export default {
},
methods: {
...mapActions(['toggleResolveNote']),
+ shouldToggleResolved(shouldResolve, beforeSubmitDiscussionState) {
+ // shouldBeResolved() checks the actual resolution state,
+ // considering batchComments (EEP), if applicable/enabled.
+ const newResolvedStateAfterUpdate =
+ this.shouldBeResolved && this.shouldBeResolved(shouldResolve);
+
+ const shouldToggleState =
+ newResolvedStateAfterUpdate !== undefined &&
+ beforeSubmitDiscussionState !== newResolvedStateAfterUpdate;
+
+ return shouldResolve || shouldToggleState;
+ },
handleUpdate(shouldResolve) {
const beforeSubmitDiscussionState = this.discussionResolved;
this.isSubmitting = true;
@@ -109,7 +121,7 @@ export default {
this.$emit('handleFormUpdate', this.updatedNoteBody, this.$refs.editNoteForm, () => {
this.isSubmitting = false;
- if (shouldResolve) {
+ if (this.shouldToggleResolved(shouldResolve, beforeSubmitDiscussionState)) {
this.resolveHandler(beforeSubmitDiscussionState);
}
});