Commit 45d8a62a authored by Phil Hughes's avatar Phil Hughes

Merge branch...

Merge branch '9971-move-ee-differences-for-app-assets-javascripts-notes-components-note_form-vue' into 'master'

Resolve "Move EE differences for `app/assets/javascripts/notes/components/note_form.vue`"

Closes #9971

See merge request gitlab-org/gitlab-ee!11151
parents bbf26b9c 9fdd97f9
...@@ -8,7 +8,7 @@ import issuableStateMixin from '../mixins/issuable_state'; ...@@ -8,7 +8,7 @@ import issuableStateMixin from '../mixins/issuable_state';
import resolvable from '../mixins/resolvable'; import resolvable from '../mixins/resolvable';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { getDraft, updateDraft } from '~/lib/utils/autosave'; import { getDraft, updateDraft } from '~/lib/utils/autosave';
import noteFormMixin from 'ee/batch_comments/mixins/note_form'; import noteFormMixin from 'ee_else_ce/notes/mixins/note_form';
export default { export default {
name: 'NoteForm', name: 'NoteForm',
...@@ -196,31 +196,6 @@ export default { ...@@ -196,31 +196,6 @@ export default {
return shouldResolve || shouldToggleState; return shouldResolve || shouldToggleState;
}, },
handleKeySubmit() {
if (this.showBatchCommentsActions) {
this.handleAddToReview();
} else {
this.handleUpdate();
}
},
handleUpdate(shouldResolve) {
const beforeSubmitDiscussionState = this.discussionResolved;
this.isSubmitting = true;
this.$emit(
'handleFormUpdate',
this.updatedNoteBody,
this.$refs.editNoteForm,
() => {
this.isSubmitting = false;
if (this.shouldToggleResolved(shouldResolve, beforeSubmitDiscussionState)) {
this.resolveHandler(beforeSubmitDiscussionState);
}
},
this.discussionResolved ? !this.isUnresolving : this.isResolving,
);
},
editMyLastNote() { editMyLastNote() {
if (this.updatedNoteBody === '') { if (this.updatedNoteBody === '') {
const lastNoteInDiscussion = this.getDiscussionLastNote(this.discussion); const lastNoteInDiscussion = this.getDiscussionLastNote(this.discussion);
...@@ -290,6 +265,7 @@ export default { ...@@ -290,6 +265,7 @@ export default {
></textarea> ></textarea>
</markdown-field> </markdown-field>
<div class="note-form-actions clearfix"> <div class="note-form-actions clearfix">
<template v-if="showBatchCommentsActions">
<p v-if="showResolveDiscussionToggle"> <p v-if="showResolveDiscussionToggle">
<label> <label>
<template v-if="discussionResolved"> <template v-if="discussionResolved">
...@@ -306,7 +282,7 @@ export default { ...@@ -306,7 +282,7 @@ export default {
</template> </template>
</label> </label>
</p> </p>
<div v-if="showBatchCommentsActions"> <div>
<button <button
:disabled="isDisabled" :disabled="isDisabled"
type="button" type="button"
...@@ -332,6 +308,7 @@ export default { ...@@ -332,6 +308,7 @@ export default {
{{ __('Cancel') }} {{ __('Cancel') }}
</button> </button>
</div> </div>
</template>
<template v-else> <template v-else>
<button <button
:disabled="isDisabled" :disabled="isDisabled"
......
export default {
data() {
return {
showBatchCommentsActions: false,
};
},
methods: {
handleKeySubmit() {
this.handleUpdate();
},
handleUpdate(shouldResolve) {
const beforeSubmitDiscussionState = this.discussionResolved;
this.isSubmitting = true;
this.$emit('handleFormUpdate', this.updatedNoteBody, this.$refs.editNoteForm, () => {
this.isSubmitting = false;
if (this.shouldToggleResolved(shouldResolve, beforeSubmitDiscussionState)) {
this.resolveHandler(beforeSubmitDiscussionState);
}
});
},
},
};
...@@ -24,6 +24,31 @@ export default { ...@@ -24,6 +24,31 @@ export default {
}, },
}, },
methods: { methods: {
handleKeySubmit() {
if (this.showBatchCommentsActions) {
this.handleAddToReview();
} else {
this.handleUpdate();
}
},
handleUpdate(shouldResolve) {
const beforeSubmitDiscussionState = this.discussionResolved;
this.isSubmitting = true;
this.$emit(
'handleFormUpdate',
this.updatedNoteBody,
this.$refs.editNoteForm,
() => {
this.isSubmitting = false;
if (this.shouldToggleResolved(shouldResolve, beforeSubmitDiscussionState)) {
this.resolveHandler(beforeSubmitDiscussionState);
}
},
this.discussionResolved ? !this.isUnresolving : this.isResolving,
);
},
shouldBeResolved(resolveStatus) { shouldBeResolved(resolveStatus) {
if (this.withBatchComments) { if (this.withBatchComments) {
return ( return (
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment