diff options
author | Phil Hughes <me@iamphill.com> | 2018-12-04 19:29:05 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-12-05 14:42:41 +0300 |
commit | 6dfede5a6d69f230b049d339af19462573a046e4 (patch) | |
tree | ac4e63af10bc48220059d24a44cce4a9d1b0efaf /app/assets/javascripts/diffs/store/mutations.js | |
parent | 1c9b10016a30dc8b8a7aa2a64eb0175973661087 (diff) |
Fixed multiple discussions getting added to diff lines
Closes https://gitlab.com/gitlab-org/gitlab-ee/issues/8195
Diffstat (limited to 'app/assets/javascripts/diffs/store/mutations.js')
-rw-r--r-- | app/assets/javascripts/diffs/store/mutations.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/app/assets/javascripts/diffs/store/mutations.js b/app/assets/javascripts/diffs/store/mutations.js index f0895661bf2..331fb052371 100644 --- a/app/assets/javascripts/diffs/store/mutations.js +++ b/app/assets/javascripts/diffs/store/mutations.js @@ -130,7 +130,7 @@ export default { if (file.highlighted_diff_lines) { file.highlighted_diff_lines = file.highlighted_diff_lines.map(line => { - if (lineCheck(line)) { + if (!line.discussions.some(({ id }) => discussion.id === id) && lineCheck(line)) { return { ...line, discussions: line.discussions.concat(discussion), @@ -150,11 +150,17 @@ export default { return { left: { ...line.left, - discussions: left ? line.left.discussions.concat(discussion) : [], + discussions: + left && !line.left.discussions.some(({ id }) => id === discussion.id) + ? line.left.discussions.concat(discussion) + : (line.left && line.left.discussions) || [], }, right: { ...line.right, - discussions: right && !left ? line.right.discussions.concat(discussion) : [], + discussions: + right && !left && !line.right.discussions.some(({ id }) => id === discussion.id) + ? line.right.discussions.concat(discussion) + : (line.right && line.right.discussions) || [], }, }; } |