diff options
Diffstat (limited to 'app/assets/javascripts/notes/components')
-rw-r--r-- | app/assets/javascripts/notes/components/note_form.vue | 14 |
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); } }); |