Commit 3158fa7e authored by Filipa Lacerda's avatar Filipa Lacerda

[ci skip] Improve code as per code reviews

parent c4381067
......@@ -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', {
......
......@@ -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"
......
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