Skip to content
代码片段 群组 项目
提交 fd4d2092 编辑于 作者: Neil Wang's avatar Neil Wang
浏览文件

bugfix: #777 帖子看不到评论

上级 ec7ca79e
No related branches found
No related tags found
无相关合并请求
...@@ -22,7 +22,7 @@ class NoteEntity { ...@@ -22,7 +22,7 @@ class NoteEntity {
static NoteEntity restore(Map<String, dynamic> map) { static NoteEntity restore(Map<String, dynamic> map) {
return NoteEntity._internal(map['id'], map['note_id'], map['noteable_id'], map['noteable_iid'], map['discussion_id'], map['system'] == 0 ? false : true, map['body'], map['assignee_id'], return NoteEntity._internal(map['id'], map['note_id'], map['noteable_id'], map['noteable_iid'], map['discussion_id'], map['system'] == 0 ? false : true, map['body'], map['assignee_id'],
map['created_at'], map['version'], map['internal'], map['created_at'], map['version'], map['internal'],
assigneeEntity: AssigneeEntity.restore(map['author'])); assigneeEntity: map['author'] != null ? AssigneeEntity.restore(map['author']) : null);
} }
static NoteEntity create(Map<String, dynamic> map, String discussionId, int version) { static NoteEntity create(Map<String, dynamic> map, String discussionId, int version) {
......
...@@ -22,7 +22,7 @@ class NoteRepository { ...@@ -22,7 +22,7 @@ class NoteRepository {
for (var item in list) { for (var item in list) {
var assigneeEntityList = await AssigneeRepository.instance().queryById(item['assignee_id'] as int); var assigneeEntityList = await AssigneeRepository.instance().queryById(item['assignee_id'] as int);
Map<String, dynamic> newItem = Map.from(item); Map<String, dynamic> newItem = Map.from(item);
newItem['author'] = assigneeEntityList.first.toMap(); if (assigneeEntityList.isNotEmpty) newItem['author'] = assigneeEntityList.first.toMap();
newList.add(newItem); newList.add(newItem);
} }
return newList.map((e) => NoteEntity.restore(e)).toList(); return newList.map((e) => NoteEntity.restore(e)).toList();
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册