[Room] Fix join invitation to direct chat

This commit is contained in:
Christian Pauly 2020-01-28 09:15:53 +01:00
parent 5325061876
commit 289c5c618d

View file

@ -458,10 +458,11 @@ class Room {
try { try {
await client.jsonRequest( await client.jsonRequest(
type: HTTPType.POST, action: "/client/r0/rooms/${id}/join"); type: HTTPType.POST, action: "/client/r0/rooms/${id}/join");
if (states.containsKey(client.userID) && final Event invitation = getState("m.room.member", client.userID);
states[client.userID].content["is_direct"] is bool && if (invitation != null &&
states[client.userID].content["is_direct"]) { invitation.content["is_direct"] is bool &&
await addToDirectChat(states[client.userID].sender.id); invitation.content["is_direct"]) {
await addToDirectChat(invitation.sender.id);
} }
} on MatrixException catch (exception) { } on MatrixException catch (exception) {
if (exception.errorMessage == "No known servers") { if (exception.errorMessage == "No known servers") {