diff options
author | Phil Hughes <me@iamphill.com> | 2018-10-04 10:37:24 +0300 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-10-12 16:11:03 +0300 |
commit | 95d90966d1e0e066fb02f08cb76f7d0ef262b429 (patch) | |
tree | 237139da7ba5fb0ac3b85b54bd1b35abd39bca93 /app/assets | |
parent | 30f019dca78bb64bcb8b355a267be006884e6d8f (diff) |
Merge branch '51958-fix-mr-discussion-loading' into 'master'
Fix MR discussion not loaded issue
Closes #51958
See merge request gitlab-org/gitlab-ce!21982
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/diffs/store/utils.js | 21 | ||||
-rw-r--r-- | app/assets/javascripts/notes/stores/getters.js | 4 |
2 files changed, 21 insertions, 4 deletions
diff --git a/app/assets/javascripts/diffs/store/utils.js b/app/assets/javascripts/diffs/store/utils.js index b7e52a8f37f..a027da971b5 100644 --- a/app/assets/javascripts/diffs/store/utils.js +++ b/app/assets/javascripts/diffs/store/utils.js @@ -230,7 +230,17 @@ export function getDiffPositionByLineCode(diffFiles) { const { lineCode, oldLine, newLine } = line; if (lineCode) { - acc[lineCode] = { baseSha, headSha, startSha, newPath, oldPath, oldLine, newLine }; + acc[lineCode] = { + baseSha, + headSha, + startSha, + newPath, + oldPath, + oldLine, + newLine, + lineCode, + positionType: 'text', + }; } }); } @@ -245,5 +255,12 @@ export function isDiscussionApplicableToLine(discussion, diffPosition) { const originalRefs = convertObjectPropsToCamelCase(discussion.original_position.formatter); const refs = convertObjectPropsToCamelCase(discussion.position.formatter); - return _.isEqual(refs, diffPosition) || _.isEqual(originalRefs, diffPosition); + if (discussion.original_position && discussion.position) { + const originalRefs = convertObjectPropsToCamelCase(discussion.original_position); + const refs = convertObjectPropsToCamelCase(discussion.position); + + return _.isEqual(refs, diffPositionCopy) || _.isEqual(originalRefs, diffPositionCopy); + } + + return latestDiff && discussion.active && lineCode === discussion.line_code; } diff --git a/app/assets/javascripts/notes/stores/getters.js b/app/assets/javascripts/notes/stores/getters.js index d4babf1fab2..75832884711 100644 --- a/app/assets/javascripts/notes/stores/getters.js +++ b/app/assets/javascripts/notes/stores/getters.js @@ -126,8 +126,8 @@ export const unresolvedDiscussionsIdsByDiff = (state, getters) => const filenameComparison = a.diff_file.file_path.localeCompare(b.diff_file.file_path); // Get the line numbers, to compare within the same file - const aLines = [a.position.formatter.new_line, a.position.formatter.old_line]; - const bLines = [b.position.formatter.new_line, b.position.formatter.old_line]; + const aLines = [a.position.new_line, a.position.old_line]; + const bLines = [b.position.new_line, b.position.old_line]; return filenameComparison < 0 || (filenameComparison === 0 && |