Commit 5c6f55ba authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'mr-diff-discussion-deletion' into 'master'

Fixes diff discussions not being fully removed

Closes #53317

See merge request gitlab-org/gitlab-ce!22680
parents b7e318f9 605e7fdd
...@@ -153,13 +153,9 @@ export default { ...@@ -153,13 +153,9 @@ export default {
}, },
setDiscussions() { setDiscussions() {
if (this.isNotesFetched && !this.assignedDiscussions && !this.isLoading) { if (this.isNotesFetched && !this.assignedDiscussions && !this.isLoading) {
requestIdleCallback( this.assignedDiscussions = true;
() =>
this.assignDiscussionsToDiff().then(() => { requestIdleCallback(() => this.assignDiscussionsToDiff(), { timeout: 1000 });
this.assignedDiscussions = true;
}),
{ timeout: 1000 },
);
} }
}, },
adjustView() { adjustView() {
......
...@@ -133,7 +133,7 @@ export default { ...@@ -133,7 +133,7 @@ export default {
}, },
right: { right: {
...line.right, ...line.right,
discussions: right ? line.right.discussions.concat(discussion) : [], discussions: right && !left ? line.right.discussions.concat(discussion) : [],
}, },
}; };
} }
......
...@@ -221,6 +221,7 @@ describe('DiffsStoreMutations', () => { ...@@ -221,6 +221,7 @@ describe('DiffsStoreMutations', () => {
expect(state.diffFiles[0].parallelDiffLines[0].left.discussions.length).toEqual(1); expect(state.diffFiles[0].parallelDiffLines[0].left.discussions.length).toEqual(1);
expect(state.diffFiles[0].parallelDiffLines[0].left.discussions[0].id).toEqual(1); expect(state.diffFiles[0].parallelDiffLines[0].left.discussions[0].id).toEqual(1);
expect(state.diffFiles[0].parallelDiffLines[0].right.discussions).toEqual([]);
expect(state.diffFiles[0].highlightedDiffLines[0].discussions.length).toEqual(1); expect(state.diffFiles[0].highlightedDiffLines[0].discussions.length).toEqual(1);
expect(state.diffFiles[0].highlightedDiffLines[0].discussions[0].id).toEqual(1); expect(state.diffFiles[0].highlightedDiffLines[0].discussions[0].id).toEqual(1);
......
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