potentially fix direct chats going missing
This commit is contained in:
parent
8db8972c2f
commit
2999ceec9e
|
@ -168,13 +168,12 @@ class Client {
|
||||||
if (accountData['m.direct'] != null &&
|
if (accountData['m.direct'] != null &&
|
||||||
accountData['m.direct'].content[userId] is List<dynamic> &&
|
accountData['m.direct'].content[userId] is List<dynamic> &&
|
||||||
accountData['m.direct'].content[userId].length > 0) {
|
accountData['m.direct'].content[userId].length > 0) {
|
||||||
if (getRoomById(accountData['m.direct'].content[userId][0]) != null) {
|
for (final roomId in accountData['m.direct'].content[userId]) {
|
||||||
return accountData['m.direct'].content[userId][0];
|
final room = getRoomById(roomId);
|
||||||
|
if (room != null && room.membership == Membership.join) {
|
||||||
|
return roomId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
(accountData['m.direct'].content[userId] as List<dynamic>)
|
|
||||||
.remove(accountData['m.direct'].content[userId][0]);
|
|
||||||
api.setAccountData(userId, 'm.direct', directChats);
|
|
||||||
return getDirectChatFromUserId(userId);
|
|
||||||
}
|
}
|
||||||
for (var i = 0; i < rooms.length; i++) {
|
for (var i = 0; i < rooms.length; i++) {
|
||||||
if (rooms[i].membership == Membership.invite &&
|
if (rooms[i].membership == Membership.invite &&
|
||||||
|
|
Loading…
Reference in a new issue