Commit 04f20f75 authored by Phil Hughes's avatar Phil Hughes

Fixed image discussions not showing on the changes tab

Closes https://gitlab.com/gitlab-org/gitlab/-/issues/225922
parent 576beef1
......@@ -248,7 +248,7 @@ export default {
});
}
if (!file.parallel_diff_lines || !file.highlighted_diff_lines) {
if (!file.parallel_diff_lines.length || !file.highlighted_diff_lines.length) {
const newDiscussions = (file.discussions || [])
.filter(d => d.id !== discussion.id)
.concat(discussion);
......
---
title: Fixed image comments not showing on the changes tab
merge_request:
author:
type: fixed
......@@ -645,6 +645,36 @@ describe('DiffsStoreMutations', () => {
expect(state.diffFiles[0].highlighted_diff_lines[0].discussions).toHaveLength(1);
expect(state.diffFiles[0].highlighted_diff_lines[0].discussions[0].id).toBe(1);
});
it('should add discussion to file', () => {
const state = {
latestDiff: true,
diffFiles: [
{
file_hash: 'ABC',
discussions: [],
parallel_diff_lines: [],
highlighted_diff_lines: [],
},
],
};
const discussion = {
id: 1,
line_code: 'ABC_1',
diff_discussion: true,
resolvable: true,
diff_file: {
file_hash: state.diffFiles[0].file_hash,
},
};
mutations[types.SET_LINE_DISCUSSIONS_FOR_FILE](state, {
discussion,
diffPositionByLineCode: null,
});
expect(state.diffFiles[0].discussions.length).toEqual(1);
});
});
describe('REMOVE_LINE_DISCUSSIONS', () => {
......
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