diff --git a/lib/src/Event.dart b/lib/src/Event.dart index 775a0b0b..0470295f 100644 --- a/lib/src/Event.dart +++ b/lib/src/Event.dart @@ -153,6 +153,9 @@ class Event { /// from the database and the timelines. Future 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", diff --git a/lib/src/Store.dart b/lib/src/Store.dart index e7cfc218..f4af5846 100644 --- a/lib/src/Store.dart +++ b/lib/src/Store.dart @@ -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