Merge branch 'krille/only-request-valid-mxid' into 'main'
fix: Only request users which are valid mxid Closes famedly/company/product-management#1003 See merge request famedly/company/frontend/famedlysdk!1288
This commit is contained in:
commit
cf0e8200f0
|
|
@ -348,11 +348,13 @@ class Room {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return client.directChats.entries
|
final mxId = client.directChats.entries
|
||||||
.firstWhereOrNull((MapEntry<String, dynamic> e) {
|
.firstWhereOrNull((MapEntry<String, dynamic> e) {
|
||||||
final roomIds = e.value;
|
final roomIds = e.value;
|
||||||
return roomIds is List<dynamic> && roomIds.contains(id);
|
return roomIds is List<dynamic> && roomIds.contains(id);
|
||||||
})?.key;
|
})?.key;
|
||||||
|
if (mxId?.isValidMatrixId == true) return mxId;
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Wheither this is a direct chat or not
|
/// Wheither this is a direct chat or not
|
||||||
|
|
@ -1591,7 +1593,7 @@ class Room {
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
return user.asUser;
|
return user.asUser;
|
||||||
} else {
|
} else {
|
||||||
requestUser(mxID, ignoreErrors: true);
|
if (mxID.isValidMatrixId) requestUser(mxID, ignoreErrors: true);
|
||||||
return User(mxID, room: this);
|
return User(mxID, room: this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1606,6 +1608,8 @@ class Room {
|
||||||
bool ignoreErrors = false,
|
bool ignoreErrors = false,
|
||||||
bool requestProfile = true,
|
bool requestProfile = true,
|
||||||
}) async {
|
}) async {
|
||||||
|
assert(mxID.isValidMatrixId);
|
||||||
|
|
||||||
// Checks if the user is really missing
|
// Checks if the user is really missing
|
||||||
final stateUser = getState(EventTypes.RoomMember, mxID);
|
final stateUser = getState(EventTypes.RoomMember, mxID);
|
||||||
if (stateUser != null) {
|
if (stateUser != null) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue