Commit d72a61b4 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Handle transformed notes from polling response

Transforms notes when the note was transformed in some other tab
parent ab391b77
......@@ -193,6 +193,10 @@ export default {
const noteObj = utils.findNoteObjectById(state.discussions, note.discussion_id);
if (noteObj.individual_note) {
if (note.type === constants.DISCUSSION_NOTE) {
noteObj.individual_note = false;
}
noteObj.notes.splice(0, 1, note);
} else {
const comment = utils.findNoteObjectById(noteObj.notes, note.id);
......
import Vue from 'vue';
import mutations from '~/notes/stores/mutations';
import { DISCUSSION_NOTE } from '~/notes/constants';
import {
note,
discussionMock,
......@@ -326,6 +327,18 @@ describe('Notes Store mutations', () => {
expect(state.discussions[0].notes[0].note).toEqual('Foo');
});
it('transforms an individual note to discussion', () => {
const state = {
discussions: [individualNote],
};
const transformedNote = { ...individualNote.notes[0], type: DISCUSSION_NOTE };
mutations.UPDATE_NOTE(state, transformedNote);
expect(state.discussions[0].individual_note).toEqual(false);
});
});
describe('CLOSE_ISSUE', () => {
......
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