Minor fixes

This commit is contained in:
Christian Pauly 2019-06-12 12:04:52 +02:00
parent f8557c38f5
commit d5d1aa53b2
2 changed files with 6 additions and 7 deletions

View file

@ -44,7 +44,7 @@ class Room {
String topic;
/// The avatar of the room if set by a participant.
MxContent avatar;
MxContent avatar = MxContent("");
/// The count of unread notifications.
int notificationCount;

View file

@ -132,20 +132,19 @@ class User {
if (roomID != null) return roomID;
// Start a new direct chat
Map<String, dynamic> resp = await room.client.connection
final dynamic resp = await room.client.connection
.jsonRequest(type: "POST", action: "/client/r0/createRoom", data: {
"invite": [id],
"is_direct": true,
"preset": "trusted_private_chat"
});
if (resp is ErrorResponse) return null;
if (resp is ErrorResponse || resp["room_id"] == null) return null;
// TODO: Update m.direct data
/*room.client.connection.jsonRequest(type: "PUT", action: "/client/r0/user/${room.client.userID}/account_data/m.direct", data: {
final String newRoomID = resp["room_id"];
});*/
await Room(id: newRoomID).addToDirectChat(id);
return resp["room_id"];
return newRoomID;
}
}