Commit 5c39c7c3 authored by Phil Hughes's avatar Phil Hughes

Updated latestDiff logic to only be used to LegacyDiffNotes

parent 5eef5f24
......@@ -86,8 +86,6 @@ export default {
},
[types.SET_LINE_DISCUSSIONS_FOR_FILE](state, { fileHash, discussions, diffPositionByLineCode }) {
if (!state.latestDiff) return;
const selectedFile = state.diffFiles.find(f => f.fileHash === fileHash);
const firstDiscussion = discussions[0];
const isDiffDiscussion = firstDiscussion.diff_discussion;
......@@ -99,7 +97,7 @@ export default {
isDiffDiscussion &&
hasLineCode &&
diffPosition &&
isDiscussionApplicableToLine(firstDiscussion, diffPosition)
isDiscussionApplicableToLine(firstDiscussion, diffPosition, state.latestDiff)
) {
const targetLine = selectedFile.parallelDiffLines.find(
line =>
......
......@@ -254,7 +254,7 @@ export function getDiffPositionByLineCode(diffFiles) {
// This method will check whether the discussion is still applicable
// to the diff line in question regarding different versions of the MR
export function isDiscussionApplicableToLine(discussion, diffPosition) {
export function isDiscussionApplicableToLine(discussion, diffPosition, latestDiff) {
const { lineCode, ...diffPositionCopy } = diffPosition;
if (discussion.original_position && discussion.position) {
......@@ -264,5 +264,5 @@ export function isDiscussionApplicableToLine(discussion, diffPosition) {
return _.isEqual(refs, diffPositionCopy) || _.isEqual(originalRefs, diffPositionCopy);
}
return discussion.active && lineCode === discussion.line_code;
return latestDiff && discussion.active && lineCode === discussion.line_code;
}
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