Fix room account data in store

This commit is contained in:
Christian Pauly 2020-01-04 16:10:59 +00:00
parent 90672c769e
commit f466f579a1
1 changed files with 2 additions and 3 deletions

View File

@ -253,7 +253,7 @@ class Store extends StoreAPI {
/// Stores an EventUpdate object in the database. Must be called inside of /// Stores an EventUpdate object in the database. Must be called inside of
/// [transaction]. /// [transaction].
Future<void> storeEventUpdate(EventUpdate eventUpdate) { Future<void> storeEventUpdate(EventUpdate eventUpdate) {
if (txn == null) return null; if (txn == null || eventUpdate.type == "ephemeral") return null;
Map<String, dynamic> eventContent = eventUpdate.content; Map<String, dynamic> eventContent = eventUpdate.content;
String type = eventUpdate.type; String type = eventUpdate.type;
String chatId = eventUpdate.roomID; String chatId = eventUpdate.roomID;
@ -327,7 +327,7 @@ class Store extends StoreAPI {
eventContent["type"], eventContent["type"],
json.encode(eventContent["content"]), json.encode(eventContent["content"]),
]); ]);
} else { } else if (type == "account_data") {
txn.rawInsert("INSERT OR REPLACE INTO RoomAccountData VALUES(?, ?, ?)", [ txn.rawInsert("INSERT OR REPLACE INTO RoomAccountData VALUES(?, ?, ?)", [
eventContent["type"], eventContent["type"],
chatId, chatId,
@ -413,7 +413,6 @@ class Store extends StoreAPI {
states: getStatesFromRoomId(res[i]["room_id"]), states: getStatesFromRoomId(res[i]["room_id"]),
roomAccountData: getAccountDataFromRoomId(res[i]["room_id"]), roomAccountData: getAccountDataFromRoomId(res[i]["room_id"]),
); );
roomList.add(room);
} }
return roomList; return roomList;
} }