Fix Delete function
This commit is contained in:
parent
e73d33a5e8
commit
9b0b3c0ee5
|
@ -153,6 +153,9 @@ class Event {
|
||||||
/// from the database and the timelines.
|
/// from the database and the timelines.
|
||||||
Future<dynamic> remove() async {
|
Future<dynamic> remove() async {
|
||||||
if (status < 1) {
|
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(
|
room.client.connection.onEvent.add(EventUpdate(
|
||||||
roomID: room.id,
|
roomID: room.id,
|
||||||
type: "timeline",
|
type: "timeline",
|
||||||
|
|
|
@ -220,11 +220,7 @@ class Store {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save the event in the database
|
// Save the event in the database
|
||||||
if (status == -2) {
|
if ((status == 1 || status == -1) && eventContent["txid"] is String)
|
||||||
txn.rawDelete(
|
|
||||||
"DELETE FROM Events WHERE id=?", [eventContent["event_id"]]);
|
|
||||||
} else if ((status == 1 || status == -1) &&
|
|
||||||
eventContent["txid"] is String)
|
|
||||||
txn.rawUpdate("UPDATE Events SET status=?, id=?, WHERE id=?",
|
txn.rawUpdate("UPDATE Events SET status=?, id=?, WHERE id=?",
|
||||||
[status, eventContent["event_id"], eventContent["txid"]]);
|
[status, eventContent["event_id"], eventContent["txid"]]);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue