diff options
Diffstat (limited to 'app/assets/javascripts/notes/stores/getters.js')
-rw-r--r-- | app/assets/javascripts/notes/stores/getters.js | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/app/assets/javascripts/notes/stores/getters.js b/app/assets/javascripts/notes/stores/getters.js index 6fb4fdf74da..d4babf1fab2 100644 --- a/app/assets/javascripts/notes/stores/getters.js +++ b/app/assets/javascripts/notes/stores/getters.js @@ -1,5 +1,6 @@ import _ from 'underscore'; import * as constants from '../constants'; +import { reduceDiscussionsToLineCodes } from './utils'; import { collapseSystemNotes } from './collapse_utils'; export const discussions = state => collapseSystemNotes(state.discussions); @@ -29,21 +30,7 @@ export const notesById = state => }, {}); export const discussionsStructuredByLineCode = state => - state.discussions.reduce((acc, note) => { - if (note.diff_discussion && note.line_code && note.resolvable) { - // For context about line notes: there might be multiple notes with the same line code - const items = acc[note.line_code] || []; - if (note.diff_file) { - Object.assign(note, { fileHash: note.diff_file.file_hash }); - // delete note.diff_file; - } - - items.push(note); - - Object.assign(acc, { [note.line_code]: items }); - } - return acc; - }, {}); + reduceDiscussionsToLineCodes(state.discussions); export const noteableType = state => { const { ISSUE_NOTEABLE_TYPE, MERGE_REQUEST_NOTEABLE_TYPE, EPIC_NOTEABLE_TYPE } = constants; |