summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2018-07-12 00:34:00 +0200
committerFatih Acet <acetfatih@gmail.com>2018-07-18 12:55:55 +0200
commite868d09dbf9672100759bed9908de8f52b2603dc (patch)
treeb36a6e3a4069537347c6da02e46ab9b5cab89ecd
parent1f2d2511441c71afa04ba053230cda6afb35d51e (diff)
downloadgitlab-ce-e868d09dbf9672100759bed9908de8f52b2603dc.tar.gz
Use built-in autosave mixin in diff line note form.
-rw-r--r--app/assets/javascripts/diffs/components/diff_line_note_form.vue12
1 files changed, 5 insertions, 7 deletions
diff --git a/app/assets/javascripts/diffs/components/diff_line_note_form.vue b/app/assets/javascripts/diffs/components/diff_line_note_form.vue
index 32f9516d332..7a04ca6357c 100644
--- a/app/assets/javascripts/diffs/components/diff_line_note_form.vue
+++ b/app/assets/javascripts/diffs/components/diff_line_note_form.vue
@@ -5,13 +5,14 @@ import createFlash from '~/flash';
import { s__ } from '~/locale';
import noteForm from '../../notes/components/note_form.vue';
import { getNoteFormData } from '../store/utils';
-import Autosave from '../../autosave';
+import autosave from '../../notes/mixins/autosave';
import { DIFF_NOTE_TYPE, NOTE_TYPE } from '../constants';
export default {
components: {
noteForm,
},
+ mixins: [autosave],
props: {
diffFileHash: {
type: String,
@@ -41,28 +42,25 @@ export default {
},
mounted() {
if (this.isLoggedIn) {
- const noteableData = this.getNoteableData;
+ const noteableData = this.noteableData;
const keys = [
- NOTE_TYPE,
- this.noteableType,
- noteableData.id,
noteableData.diff_head_sha,
DIFF_NOTE_TYPE,
noteableData.source_project_id,
this.line.lineCode,
];
- this.autosave = new Autosave($(this.$refs.noteForm.$refs.textarea), keys);
+ this.initAutoSave(noteableData, keys);
}
},
methods: {
...mapActions('diffs', ['cancelCommentForm']),
...mapActions(['saveNote', 'refetchDiscussionById']),
handleCancelCommentForm() {
- this.autosave.reset();
this.cancelCommentForm({
lineCode: this.line.lineCode,
});
+ this.resetAutoSave();
},
handleSaveNote(note) {
const selectedDiffFile = this.getDiffFileByHash(this.diffFileHash);