Merge branch 'room-fix-requestuser' into 'master'
[Room] Ignore errors on requestUser See merge request famedly/famedlysdk!246
This commit is contained in:
commit
41cd69548f
|
@ -1097,9 +1097,7 @@ class Room {
|
||||||
if (states[mxID] != null) {
|
if (states[mxID] != null) {
|
||||||
return states[mxID].asUser;
|
return states[mxID].asUser;
|
||||||
} else {
|
} else {
|
||||||
try {
|
requestUser(mxID, ignoreErrors: true);
|
||||||
requestUser(mxID);
|
|
||||||
} catch (_) {}
|
|
||||||
return User(mxID, room: this);
|
return User(mxID, room: this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1108,7 +1106,7 @@ class Room {
|
||||||
|
|
||||||
/// Requests a missing [User] for this room. Important for clients using
|
/// Requests a missing [User] for this room. Important for clients using
|
||||||
/// lazy loading.
|
/// 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;
|
if (mxID == null || !_requestingMatrixIds.add(mxID)) return null;
|
||||||
Map<String, dynamic> resp;
|
Map<String, dynamic> resp;
|
||||||
try {
|
try {
|
||||||
|
@ -1117,7 +1115,7 @@ class Room {
|
||||||
action: "/client/r0/rooms/$id/state/m.room.member/$mxID");
|
action: "/client/r0/rooms/$id/state/m.room.member/$mxID");
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
_requestingMatrixIds.remove(mxID);
|
_requestingMatrixIds.remove(mxID);
|
||||||
rethrow;
|
if (!ignoreErrors) rethrow;
|
||||||
}
|
}
|
||||||
final User user = User(mxID,
|
final User user = User(mxID,
|
||||||
displayName: resp["displayname"],
|
displayName: resp["displayname"],
|
||||||
|
|
|
@ -196,7 +196,7 @@ packages:
|
||||||
name: http
|
name: http
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.12.0+4"
|
version: "0.12.0+2"
|
||||||
http_multi_server:
|
http_multi_server:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
Loading…
Reference in a new issue