Merge branch 'ce-7921-fix-batch-comments-resolution' into 'master'
Backport CE changes for: Resolves "Reviews: Resolving or unresolving discussions with “Add comment now” does not work" See merge request gitlab-org/gitlab-ce!22303
This commit is contained in:
commit
0d3cc86636
1 changed files with 13 additions and 1 deletions
|
@ -102,6 +102,18 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['toggleResolveNote']),
|
...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) {
|
handleUpdate(shouldResolve) {
|
||||||
const beforeSubmitDiscussionState = this.discussionResolved;
|
const beforeSubmitDiscussionState = this.discussionResolved;
|
||||||
this.isSubmitting = true;
|
this.isSubmitting = true;
|
||||||
|
@ -109,7 +121,7 @@ export default {
|
||||||
this.$emit('handleFormUpdate', this.updatedNoteBody, this.$refs.editNoteForm, () => {
|
this.$emit('handleFormUpdate', this.updatedNoteBody, this.$refs.editNoteForm, () => {
|
||||||
this.isSubmitting = false;
|
this.isSubmitting = false;
|
||||||
|
|
||||||
if (shouldResolve) {
|
if (this.shouldToggleResolved(shouldResolve, beforeSubmitDiscussionState)) {
|
||||||
this.resolveHandler(beforeSubmitDiscussionState);
|
this.resolveHandler(beforeSubmitDiscussionState);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue