diff options
author | Fatih Acet <acetfatih@gmail.com> | 2017-08-22 22:10:35 +0300 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2017-08-22 22:10:35 +0300 |
commit | d0516216049e3231ab23a0f610940af615f1d9a3 (patch) | |
tree | 636819ae153dcdf138839ec518281c2e0adab74f /app/assets/javascripts/notes | |
parent | 479670df94a4dea82350222c1b09c05e1e2ac18d (diff) | |
download | gitlab-ce-d0516216049e3231ab23a0f610940af615f1d9a3.tar.gz |
IssueNotesRefactor: Support legacy multiple notes for individual_note: true case.
Diffstat (limited to 'app/assets/javascripts/notes')
-rw-r--r-- | app/assets/javascripts/notes/stores/mutations.js | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/app/assets/javascripts/notes/stores/mutations.js b/app/assets/javascripts/notes/stores/mutations.js index ce56fe74b1e..3b2b2089d6e 100644 --- a/app/assets/javascripts/notes/stores/mutations.js +++ b/app/assets/javascripts/notes/stores/mutations.js @@ -70,7 +70,22 @@ export default { Object.assign(state, { userData: data }); }, [types.SET_INITIAL_NOTES](state, notesData) { - Object.assign(state, { notes: notesData }); + const notes = []; + + notesData.forEach((note) => { + // To support legacy notes, should be very rare case. + if (note.individual_note && note.notes.length > 1) { + note.notes.forEach((n) => { + const nn = Object.assign({}, note); + nn.notes = [n]; // override notes array to only have one item to mimick individual_note + notes.push(nn); + }); + } else { + notes.push(note); + } + }); + + Object.assign(state, { notes }); }, [types.SET_LAST_FETCHED_AT](state, fetchedAt) { |