Commit 9e130f19 authored by Martin Wortschack's avatar Martin Wortschack

Merge branch 'ph/225922/fixedImageDiscussionsNotShowingOnChangesTab' into 'master'

Fixed image discussions not showing on the changes tab

Closes #225922

See merge request gitlab-org/gitlab!41683
parents 5b0d288d a3591ddf
......@@ -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: 41683
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