[Room] Fix request User method
This commit is contained in:
parent
7842c509e1
commit
eccc880fcb
|
@ -282,12 +282,12 @@ class Room {
|
|||
|
||||
// Try to manipulate the file size and create a thumbnail
|
||||
try {
|
||||
Image image = copyResize(decodeImage(file.readAsBytesSync()), width: 1200);
|
||||
Image image =
|
||||
copyResize(decodeImage(file.readAsBytesSync()), width: 1200);
|
||||
Image thumbnail = copyResize(image, width: 800);
|
||||
|
||||
file = File(path)..writeAsBytesSync(encodePng(image));
|
||||
File thumbnailFile = File(path)
|
||||
..writeAsBytesSync(encodePng(thumbnail));
|
||||
File thumbnailFile = File(path)..writeAsBytesSync(encodePng(thumbnail));
|
||||
final dynamic uploadThumbnailResp =
|
||||
await client.connection.upload(thumbnailFile);
|
||||
if (uploadThumbnailResp is ErrorResponse) throw (uploadThumbnailResp);
|
||||
|
@ -652,9 +652,10 @@ class Room {
|
|||
type: HTTPType.GET,
|
||||
action: "/client/r0/rooms/$id/state/m.room.member/$mxID");
|
||||
if (resp is ErrorResponse) return null;
|
||||
// Somehow we miss the mxid in the response and only get the content of the event.
|
||||
resp["matrix_id"] = mxID;
|
||||
return RoomState.fromJson(resp, this).asUser;
|
||||
return User(mxID,
|
||||
displayName: resp["displayname"],
|
||||
avatarUrl: resp["avatar_url"],
|
||||
room: this);
|
||||
}
|
||||
|
||||
/// Searches for the event in the store. If it isn't found, try to request it
|
||||
|
|
16
pubspec.lock
16
pubspec.lock
|
@ -28,14 +28,14 @@ packages:
|
|||
name: async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.2.0"
|
||||
version: "2.3.0"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: boolean_selector
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
version: "1.0.5"
|
||||
build:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -276,7 +276,7 @@ packages:
|
|||
name: meta
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.6"
|
||||
version: "1.1.7"
|
||||
mime:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -311,14 +311,14 @@ packages:
|
|||
name: path
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.6.2"
|
||||
version: "1.6.4"
|
||||
pedantic:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: pedantic
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.7.0"
|
||||
version: "1.8.0+1"
|
||||
petitparser:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -353,7 +353,7 @@ packages:
|
|||
name: quiver
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.3"
|
||||
version: "2.0.5"
|
||||
shelf:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -393,7 +393,7 @@ packages:
|
|||
name: sqflite
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.5"
|
||||
version: "1.1.6+4"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -421,7 +421,7 @@ packages:
|
|||
name: string_scanner
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
version: "1.0.5"
|
||||
synchronized:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
@ -12,7 +12,7 @@ dependencies:
|
|||
sdk: flutter
|
||||
|
||||
# Database
|
||||
sqflite: ^1.1.0
|
||||
sqflite: ^1.1.6+4
|
||||
path: ^1.6.2
|
||||
|
||||
# Connection
|
||||
|
|
|
@ -66,17 +66,8 @@ class FakeMatrixApi extends MockClient {
|
|||
"GET": {
|
||||
"/client/r0/rooms/!localpart:server.abc/state/m.room.member/@getme:example.com":
|
||||
(var req) => {
|
||||
"content": {
|
||||
"membership": "join",
|
||||
"displayname": "You got me",
|
||||
},
|
||||
"type": "m.room.member",
|
||||
"event_id": "143273582443PhrSn:example.org",
|
||||
"room_id": "!localpart:server.abc",
|
||||
"sender": "@getme:example.com",
|
||||
"state_key": "@getme:example.com",
|
||||
"origin_server_ts": 1432735824653,
|
||||
"unsigned": {"age": 1234}
|
||||
"avatar_url": "mxc://test",
|
||||
"displayname": "You got me",
|
||||
},
|
||||
"/client/r0/rooms/!localpart:server.abc/event/1234": (var req) => {
|
||||
"content": {
|
||||
|
|
Loading…
Reference in a new issue