[Event] Refactoring

This commit is contained in:
Christian Pauly 2019-06-27 10:30:26 +02:00
parent f7e74436f4
commit e73d33a5e8
2 changed files with 5 additions and 4 deletions

View file

@ -224,9 +224,9 @@ class Store {
txn.rawDelete(
"DELETE FROM Events WHERE id=?", [eventContent["event_id"]]);
} else if ((status == 1 || status == -1) &&
eventUpdate.content["txid"] is String)
eventContent["txid"] is String)
txn.rawUpdate("UPDATE Events SET status=?, id=?, WHERE id=?",
[status, eventContent["event_id"], eventUpdate.content["txid"]]);
[status, eventContent["event_id"], eventContent["txid"]]);
else
txn.rawInsert(
"INSERT OR REPLACE INTO Events VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)", [

View file

@ -47,9 +47,10 @@ class Timeline {
int i;
for (i = 0; i < events.length; i++) {
if (events[i].content.containsKey("txid") &&
events[i].content["txid"] == txid ||
(txid != null && events[i].content["txid"] == txid) ||
events[i].id == event_id ||
(events[i].content["txid"] == unsigned_txid)) break;
(unsigned_txid != null && events[i].content["txid"] == unsigned_txid))
break;
}
return i;
}