未验证 提交 e3b96ad7 编写于 作者: F Fatih Acet

Fix placeholder note rendering

上级 70f4a26b
......@@ -191,6 +191,7 @@ export default {
if (note.placeholderType === SYSTEM_NOTE) {
return placeholderSystemNote;
}
return placeholderNote;
}
......@@ -201,7 +202,7 @@ export default {
return noteableNote;
},
componentData(note) {
return note.isPlaceholderNote ? this.discussion.notes[0] : note;
return note.isPlaceholderNote ? note.notes[0] : note;
},
toggleDiscussionHandler() {
this.toggleDiscussion({ discussionId: this.discussion.id });
......
---
title: Fix rendering placeholder notes
merge_request: 22078
author:
type: fixed
......@@ -133,4 +133,29 @@ describe('noteable_discussion component', () => {
});
});
});
describe('componentData', () => {
it('should return first note object for placeholder note', () => {
const data = {
isPlaceholderNote: true,
notes: [
{ body: 'hello world!' },
],
};
const note = vm.componentData(data);
expect(note).toEqual(data.notes[0]);
});
it('should return given note for nonplaceholder notes', () => {
const data = {
notes: [
{ id: 12 },
],
};
const note = vm.componentData(data);
expect(note).toEqual(data);
});
});
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册