Fix Delete function

This commit is contained in:
Christian Pauly 2019-06-27 10:33:43 +02:00
parent e73d33a5e8
commit 9b0b3c0ee5
2 changed files with 4 additions and 5 deletions

View file

@ -153,6 +153,9 @@ class Event {
/// from the database and the timelines.
Future<dynamic> remove() async {
if (status < 1) {
if (room.client.store != null)
room.client.store.db.rawDelete("DELETE FROM Events WHERE id=?", [id]);
room.client.connection.onEvent.add(EventUpdate(
roomID: room.id,
type: "timeline",

View file

@ -220,11 +220,7 @@ class Store {
}
// Save the event in the database
if (status == -2) {
txn.rawDelete(
"DELETE FROM Events WHERE id=?", [eventContent["event_id"]]);
} else if ((status == 1 || status == -1) &&
eventContent["txid"] is String)
if ((status == 1 || status == -1) && eventContent["txid"] is String)
txn.rawUpdate("UPDATE Events SET status=?, id=?, WHERE id=?",
[status, eventContent["event_id"], eventContent["txid"]]);
else