Merge branch 'room-fix-requestuser' into 'master'

[Room] Ignore errors on requestUser

See merge request famedly/famedlysdk!246
This commit is contained in:
Christian Pauly 2020-03-25 12:14:08 +00:00
commit 41cd69548f
2 changed files with 4 additions and 6 deletions

View file

@ -1097,9 +1097,7 @@ class Room {
if (states[mxID] != null) {
return states[mxID].asUser;
} else {
try {
requestUser(mxID);
} catch (_) {}
requestUser(mxID, ignoreErrors: true);
return User(mxID, room: this);
}
}
@ -1108,7 +1106,7 @@ class Room {
/// Requests a missing [User] for this room. Important for clients using
/// lazy loading.
Future<User> requestUser(String mxID) async {
Future<User> requestUser(String mxID, {bool ignoreErrors = false}) async {
if (mxID == null || !_requestingMatrixIds.add(mxID)) return null;
Map<String, dynamic> resp;
try {
@ -1117,7 +1115,7 @@ class Room {
action: "/client/r0/rooms/$id/state/m.room.member/$mxID");
} catch (exception) {
_requestingMatrixIds.remove(mxID);
rethrow;
if (!ignoreErrors) rethrow;
}
final User user = User(mxID,
displayName: resp["displayname"],

View file

@ -196,7 +196,7 @@ packages:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.0+4"
version: "0.12.0+2"
http_multi_server:
dependency: transitive
description: