Commit f32ec46e authored by Tim Zallmann's avatar Tim Zallmann

Fix for a check that fails if no file can be selected

parent 1be03eaa
...@@ -86,6 +86,7 @@ export default { ...@@ -86,6 +86,7 @@ export default {
[types.SET_LINE_DISCUSSIONS_FOR_FILE](state, { fileHash, discussions }) { [types.SET_LINE_DISCUSSIONS_FOR_FILE](state, { fileHash, discussions }) {
const selectedFile = state.diffFiles.find(f => f.fileHash === fileHash); const selectedFile = state.diffFiles.find(f => f.fileHash === fileHash);
if (selectedFile) {
const firstDiscussion = discussions[0]; const firstDiscussion = discussions[0];
const targetLine = selectedFile.parallelDiffLines.find( const targetLine = selectedFile.parallelDiffLines.find(
line => line =>
...@@ -115,10 +116,12 @@ export default { ...@@ -115,10 +116,12 @@ export default {
}); });
} }
} }
}
}, },
[types.REMOVE_LINE_DISCUSSIONS_FOR_FILE](state, { fileHash, lineCode }) { [types.REMOVE_LINE_DISCUSSIONS_FOR_FILE](state, { fileHash, lineCode }) {
const selectedFile = state.diffFiles.find(f => f.fileHash === fileHash); const selectedFile = state.diffFiles.find(f => f.fileHash === fileHash);
if (selectedFile) {
const targetLine = selectedFile.parallelDiffLines.find( const targetLine = selectedFile.parallelDiffLines.find(
line => line =>
(line.left && line.left.lineCode === lineCode) || (line.left && line.left.lineCode === lineCode) ||
...@@ -143,5 +146,6 @@ export default { ...@@ -143,5 +146,6 @@ export default {
}); });
} }
} }
}
}, },
}; };
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