diff --git a/app/assets/javascripts/notes/components/issue_note.vue b/app/assets/javascripts/notes/components/issue_note.vue
index b91e6d05b8f56010c74f78b7fd23c90584a4da97..eb39cbd5e7c618bad30d0e708e6ebbcb633f7f67 100644
--- a/app/assets/javascripts/notes/components/issue_note.vue
+++ b/app/assets/javascripts/notes/components/issue_note.vue
@@ -57,8 +57,23 @@ export default {
});
}
},
- formUpdateHandler() {
- // console.log('update requested', data);
+ formUpdateHandler(note) {
+ const data = {
+ endpoint: `${this.note.path}?full_data=1`,
+ note: {
+ target_type: 'issue',
+ target_id: this.note.noteable_id,
+ note,
+ },
+ };
+
+ this.$store.dispatch('updateNote', data)
+ .then(() => {
+ this.isEditing = false;
+ })
+ .catch(() => {
+ new Flash('Something went wrong while editing your comment. Please try again.'); // eslint-disable-line
+ });
},
formCancelHandler() {
this.isEditing = false;
diff --git a/app/assets/javascripts/notes/components/issue_note_body.vue b/app/assets/javascripts/notes/components/issue_note_body.vue
index 4ce7d61251c7035cc1f88ccf9e13f765dacb3bba..4f11683c7a94d31c286fc81d17c25f7fb50ce32a 100644
--- a/app/assets/javascripts/notes/components/issue_note_body.vue
+++ b/app/assets/javascripts/notes/components/issue_note_body.vue
@@ -32,6 +32,11 @@ export default {
renderGFM() {
$(this.$refs['note-body']).renderGFM();
},
+ handleFormUpdate() {
+ this.formUpdateHandler({
+ note: this.$refs.noteForm.note,
+ });
+ },
},
mounted() {
this.renderGFM();
@@ -48,7 +53,8 @@ export default {
class="note-text md">
res.json())
+ .then((res) => {
+ context.commit('updateNote', res);
+ });
+ },
};
export default {