Fix bug where we didn't correctly pull out the event_id of the deletion
This commit is contained in:
parent
4e79b09dd9
commit
1e6c5b205c
|
@ -263,13 +263,17 @@ class DataStore(RoomMemberStore, RoomStore,
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def get_current_state(self, room_id, event_type=None, state_key=""):
|
def get_current_state(self, room_id, event_type=None, state_key=""):
|
||||||
|
del_sql = (
|
||||||
|
"SELECT event_id FROM deletions WHERE deletes = e.event_id"
|
||||||
|
)
|
||||||
|
|
||||||
sql = (
|
sql = (
|
||||||
"SELECT e.*, (%(deleted)s) AS deleted FROM events as e "
|
"SELECT e.*, (%(deleted)s) AS deleted FROM events as e "
|
||||||
"INNER JOIN current_state_events as c ON e.event_id = c.event_id "
|
"INNER JOIN current_state_events as c ON e.event_id = c.event_id "
|
||||||
"INNER JOIN state_events as s ON e.event_id = s.event_id "
|
"INNER JOIN state_events as s ON e.event_id = s.event_id "
|
||||||
"WHERE c.room_id = ? "
|
"WHERE c.room_id = ? "
|
||||||
) % {
|
) % {
|
||||||
"deleted": "e.event_id IN (SELECT deletes FROM deletions)",
|
"deleted": del_sql,
|
||||||
}
|
}
|
||||||
|
|
||||||
if event_type:
|
if event_type:
|
||||||
|
|
|
@ -403,9 +403,10 @@ class SQLBaseStore(object):
|
||||||
return events
|
return events
|
||||||
|
|
||||||
def _has_been_deleted_txn(self, txn, event):
|
def _has_been_deleted_txn(self, txn, event):
|
||||||
sql = "SELECT * FROM deletions WHERE deletes = ?"
|
sql = "SELECT event_id FROM deletions WHERE deletes = ?"
|
||||||
txn.execute(sql, (event.event_id,))
|
txn.execute(sql, (event.event_id,))
|
||||||
return len(txn.fetchall()) > 0
|
result = txn.fetchone()
|
||||||
|
return result[0] if result else None
|
||||||
|
|
||||||
|
|
||||||
class Table(object):
|
class Table(object):
|
||||||
|
|
Loading…
Reference in New Issue