mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 12:36:02 -04:00
Add GET /notifications API
This commit is contained in:
parent
31b5395ab6
commit
a24bc5b2dc
4 changed files with 155 additions and 0 deletions
|
@ -74,6 +74,31 @@ class ReceiptsStore(SQLBaseStore):
|
|||
|
||||
defer.returnValue({row["room_id"]: row["event_id"] for row in rows})
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def get_receipts_for_user_with_orderings(self, user_id, receipt_type):
|
||||
def f(txn):
|
||||
sql = (
|
||||
"SELECT rl.room_id, rl.event_id,"
|
||||
" e.topological_ordering, e.stream_ordering"
|
||||
" FROM receipts_linearized rl,"
|
||||
" events e"
|
||||
" WHERE rl.room_id = e.room_id"
|
||||
" AND rl.event_id = e.event_id"
|
||||
" AND user_id = ?"
|
||||
)
|
||||
txn.execute(sql, (user_id,))
|
||||
return txn.fetchall()
|
||||
rows = yield self.runInteraction(
|
||||
"get_receipts_for_user_with_orderings", f
|
||||
)
|
||||
defer.returnValue({
|
||||
row[0]: {
|
||||
"event_id": row[1],
|
||||
"topological_ordering": row[2],
|
||||
"stream_ordering": row[3],
|
||||
} for row in rows
|
||||
})
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def get_linearized_receipts_for_rooms(self, room_ids, to_key, from_key=None):
|
||||
"""Get receipts for multiple rooms for sending to clients.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue