[Room]/[Store] Load sender user when loading event by id

Took 5 minutes
This commit is contained in:
Marcel 2019-07-28 20:19:58 +02:00
parent 29c677e5ba
commit 90a5f32e20
2 changed files with 6 additions and 2 deletions

View file

@ -503,6 +503,8 @@ class Room {
final dynamic resp = await client.connection.jsonRequest( final dynamic resp = await client.connection.jsonRequest(
type: HTTPType.GET, action: "/client/r0/rooms/$id/event/$eventID"); type: HTTPType.GET, action: "/client/r0/rooms/$id/event/$eventID");
if (resp is ErrorResponse) return null; if (resp is ErrorResponse) return null;
return Event.fromJson(resp, this); return Event.fromJson(resp, this,
senderUser:
(await client.store.getUser(matrixID: resp["sender"], room: this)));
} }
} }

View file

@ -650,7 +650,9 @@ class Store {
List<Map<String, dynamic>> res = await db.rawQuery( List<Map<String, dynamic>> res = await db.rawQuery(
"SELECT * FROM Events WHERE id=? AND chat_id=?", [eventID, room.id]); "SELECT * FROM Events WHERE id=? AND chat_id=?", [eventID, room.id]);
if (res.length == 0) return null; if (res.length == 0) return null;
return Event.fromJson(res[0], room); return Event.fromJson(res[0], room,
senderUser:
(await this.getUser(matrixID: res[0]["sender"], room: room)));
} }
Future forgetNotification(String roomID) async { Future forgetNotification(String roomID) async {