mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 10:56:06 -04:00
Get correct prev_events
This commit is contained in:
parent
1616df2f61
commit
cc44ecc62f
2 changed files with 26 additions and 15 deletions
|
@ -49,15 +49,6 @@ class EventFederationStore(SQLBaseStore):
|
|||
)
|
||||
|
||||
def _get_latest_events_in_room(self, txn, room_id):
|
||||
self._simple_select_onecol_txn(
|
||||
txn,
|
||||
table="event_forward_extremities",
|
||||
keyvalues={
|
||||
"room_id": room_id,
|
||||
},
|
||||
retcol="event_id",
|
||||
)
|
||||
|
||||
sql = (
|
||||
"SELECT e.event_id, e.depth FROM events as e "
|
||||
"INNER JOIN event_forward_extremities as f "
|
||||
|
@ -78,6 +69,27 @@ class EventFederationStore(SQLBaseStore):
|
|||
|
||||
return results
|
||||
|
||||
def _get_prev_events(self, txn, event_id):
|
||||
prev_ids = self._simple_select_onecol_txn(
|
||||
txn,
|
||||
table="event_edges",
|
||||
keyvalues={
|
||||
"event_id": event_id,
|
||||
},
|
||||
retcol="prev_event_id",
|
||||
)
|
||||
|
||||
results = []
|
||||
for prev_event_id in prev_ids:
|
||||
hashes = self._get_event_reference_hashes_txn(txn, prev_event_id)
|
||||
prev_hashes = {
|
||||
k: encode_base64(v) for k, v in hashes.items()
|
||||
if k == "sha256"
|
||||
}
|
||||
results.append((event_id, prev_hashes))
|
||||
|
||||
return results
|
||||
|
||||
def get_min_depth(self, room_id):
|
||||
return self.runInteraction(
|
||||
"get_min_depth",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue