diff options
| author | Filipa Lacerda <filipa@gitlab.com> | 2017-08-10 12:26:29 +0100 |
|---|---|---|
| committer | Filipa Lacerda <filipa@gitlab.com> | 2017-08-10 12:26:29 +0100 |
| commit | 3158fa7e89107b2fdbd5c81892a9ec17918464a7 (patch) | |
| tree | efcf395396e05dd994a3622f2d0b246e3c855b41 /app/assets/javascripts/notes | |
| parent | c438106732539d37fcb524abfe4b78e177f81691 (diff) | |
| download | gitlab-ce-3158fa7e89107b2fdbd5c81892a9ec17918464a7.tar.gz | |
[ci skip] Improve code as per code reviews
Diffstat (limited to 'app/assets/javascripts/notes')
| -rw-r--r-- | app/assets/javascripts/notes/components/issue_comment_form.vue | 21 | ||||
| -rw-r--r-- | app/assets/javascripts/notes/components/issue_discussion.vue | 2 |
2 files changed, 11 insertions, 12 deletions
diff --git a/app/assets/javascripts/notes/components/issue_comment_form.vue b/app/assets/javascripts/notes/components/issue_comment_form.vue index acb15a7c601..5b2bfeb0043 100644 --- a/app/assets/javascripts/notes/components/issue_comment_form.vue +++ b/app/assets/javascripts/notes/components/issue_comment_form.vue @@ -29,18 +29,10 @@ }, watch: { note(newNote) { - if (!_.isEmpty(newNote) && !this.isSubmitting) { - this.isSubmitButtonDisabled = false; - } else { - this.isSubmitButtonDisabled = true; - } + this.setIsSubmitButtonDisabled(newNote, this.isSubmitting); }, isSubmitting(newValue) { - if (!_.isEmpty(this.note) && !newValue) { - this.isSubmitButtonDisabled = false; - } else { - this.isSubmitButtonDisabled = true; - } + this.setIsSubmitButtonDisabled(this.note, newValue); }, }, computed: { @@ -99,6 +91,13 @@ ...mapActions([ 'saveNote', ]), + setIsSubmitButtonDisabled(note, isSubmitting) { + if (!_.isEmpty(note) && !isSubmitting) { + this.isSubmitButtonDisabled = false; + } else { + this.isSubmitButtonDisabled = true; + } + }, handleSave(withIssueAction) { if (this.note.length) { const noteData = { @@ -176,7 +175,7 @@ }, editCurrentUserLastNote() { if (this.note === '') { - const lastNote = this.getCurrentUserLastNote(window.gon.current_user_id); + const lastNote = this.getCurrentUserLastNote; if (lastNote) { eventHub.$emit('enterEditMode', { diff --git a/app/assets/javascripts/notes/components/issue_discussion.vue b/app/assets/javascripts/notes/components/issue_discussion.vue index d6dd0be55ac..b806f1bfc01 100644 --- a/app/assets/javascripts/notes/components/issue_discussion.vue +++ b/app/assets/javascripts/notes/components/issue_discussion.vue @@ -183,7 +183,7 @@ title="Add a reply">Reply...</button> <issue-note-form v-if="isReplying" - saveButtonTitle="Comment" + save-button-title="Comment" :discussion="note" :is-editing="false" @handleFormUpdate="saveReply" |
