fix:解决会话列表UnsupportedOperationException的问题

This commit is contained in:
zhongzb
2023-05-28 22:38:49 +08:00
parent 4f071b6de6
commit 9e4effbc0e
2 changed files with 10 additions and 2 deletions

View File

@@ -152,12 +152,13 @@ public class ChatServiceImpl implements ChatService {
@Override
public CursorPageBaseResp<ChatRoomResp> getRoomPage(CursorPageBaseReq request, Long uid) {
CursorPageBaseResp<Room> cursorPage = roomDao.getCursorPage(request);
ArrayList<Room> rooms = new ArrayList<>(cursorPage.getList());
if (request.isFirstPage()) {
//第一页插入置顶的大群聊
Room group = roomDao.getById(ROOM_GROUP_ID);
cursorPage.getList().add(0, group);
rooms.add(0, group);
}
return CursorPageBaseResp.init(cursorPage, RoomAdapter.buildResp(cursorPage.getList()));
return CursorPageBaseResp.init(cursorPage, RoomAdapter.buildResp(rooms));
}
@Override