diff options
author | Phil Hughes <me@iamphill.com> | 2018-09-13 12:35:42 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-09-17 09:50:37 +0100 |
commit | ef4e3b6ed37e2e1b92c1ab39e5f94d908dddb279 (patch) | |
tree | 0d4ce3e3949d35c68bf0019f8279c469be042367 /app | |
parent | f9e290b9dbcc6340d0f8fcf98fabdcdbac3a0b10 (diff) | |
download | gitlab-ce-ef4e3b6ed37e2e1b92c1ab39e5f94d908dddb279.tar.gz |
Moved legacy diff note check into util method
Un-commented out expect checks in mutation spec
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/diffs/store/mutations.js | 4 | ||||
-rw-r--r-- | app/assets/javascripts/notes/stores/utils.js | 7 |
2 files changed, 4 insertions, 7 deletions
diff --git a/app/assets/javascripts/diffs/store/mutations.js b/app/assets/javascripts/diffs/store/mutations.js index b6818f905e5..72da64bd4db 100644 --- a/app/assets/javascripts/diffs/store/mutations.js +++ b/app/assets/javascripts/diffs/store/mutations.js @@ -1,5 +1,6 @@ import Vue from 'vue'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; +import { isLegacyDiffNote } from '~/notes/stores/utils'; import { findDiffFile, addLineReferences, @@ -90,8 +91,7 @@ export default { const firstDiscussion = discussions[0]; const isDiffDiscussion = firstDiscussion.diff_discussion; const hasLineCode = firstDiscussion.line_code; - const isResolvable = - firstDiscussion.resolvable || (!firstDiscussion.resolvable && !firstDiscussion.position); + const isResolvable = firstDiscussion.resolvable || isLegacyDiffNote(firstDiscussion); const diffPosition = diffPositionByLineCode[firstDiscussion.line_code]; if ( diff --git a/app/assets/javascripts/notes/stores/utils.js b/app/assets/javascripts/notes/stores/utils.js index e2dd81273f5..eea6eb2b1af 100644 --- a/app/assets/javascripts/notes/stores/utils.js +++ b/app/assets/javascripts/notes/stores/utils.js @@ -2,6 +2,7 @@ import AjaxCache from '~/lib/utils/ajax_cache'; const REGEX_QUICK_ACTIONS = /^\/\w+.*$/gm; +export const isLegacyDiffNote = note => !note.resolvable && !note.position; export const findNoteObjectById = (notes, id) => notes.filter(n => n.id === id)[0]; export const getQuickActionText = note => { @@ -27,11 +28,7 @@ export const getQuickActionText = note => { export const reduceDiscussionsToLineCodes = selectedDiscussions => selectedDiscussions.reduce((acc, note) => { - if ( - note.diff_discussion && - note.line_code && - (note.resolvable || (!note.resolvable && !note.position)) - ) { + if (note.diff_discussion && note.line_code && (note.resolvable || isLegacyDiffNote(note))) { // For context about line notes: there might be multiple notes with the same line code const items = acc[note.line_code] || []; items.push(note); |