Commit ac3157a0 authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'mr-discussion-expanding-bug-fixes' into 'master'

Fixed hidden truncated diff lines not showing when expanded

See merge request gitlab-org/gitlab-ce!21801
parents 8c219294 305ce570
...@@ -100,7 +100,10 @@ export default { ...@@ -100,7 +100,10 @@ export default {
discussionsData.forEach(discussion => { discussionsData.forEach(discussion => {
if (discussion.diff_file) { if (discussion.diff_file) {
Object.assign(discussion, { fileHash: discussion.diff_file.file_hash }); Object.assign(discussion, {
fileHash: discussion.diff_file.file_hash,
truncated_diff_lines: discussion.truncated_diff_lines || [],
});
} }
// To support legacy notes, should be very rare case. // To support legacy notes, should be very rare case.
......
...@@ -156,6 +156,41 @@ describe('Notes Store mutations', () => { ...@@ -156,6 +156,41 @@ describe('Notes Store mutations', () => {
expect(state.discussions[2].notes[0].note).toBe(legacyNote.notes[1].note); expect(state.discussions[2].notes[0].note).toBe(legacyNote.notes[1].note);
expect(state.discussions.length).toEqual(3); expect(state.discussions.length).toEqual(3);
}); });
it('adds truncated_diff_lines if discussion is a diffFile', () => {
const state = {
discussions: [],
};
mutations.SET_INITIAL_DISCUSSIONS(state, [
{
...note,
diff_file: {
file_hash: 'a',
},
truncated_diff_lines: ['a'],
},
]);
expect(state.discussions[0].truncated_diff_lines).toEqual(['a']);
});
it('adds empty truncated_diff_lines when not in discussion', () => {
const state = {
discussions: [],
};
mutations.SET_INITIAL_DISCUSSIONS(state, [
{
...note,
diff_file: {
file_hash: 'a',
},
},
]);
expect(state.discussions[0].truncated_diff_lines).toEqual([]);
});
}); });
describe('SET_LAST_FETCHED_AT', () => { describe('SET_LAST_FETCHED_AT', () => {
......
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