mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 12:16:09 -04:00
Add GET /notifications API
This commit is contained in:
parent
31b5395ab6
commit
a24bc5b2dc
4 changed files with 155 additions and 0 deletions
|
@ -191,6 +191,34 @@ class EventPushActionsStore(SQLBaseStore):
|
|||
} for row in after_read_receipt + no_read_receipt
|
||||
])
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def get_push_actions_for_user(self, user_id, before=None, limit=50):
|
||||
def f(txn):
|
||||
before_clause = ""
|
||||
if before:
|
||||
before_clause = "AND stream_ordering < ?"
|
||||
args = [user_id, before, limit]
|
||||
else:
|
||||
args = [user_id, limit]
|
||||
sql = (
|
||||
"SELECT event_id, room_id, stream_ordering, topological_ordering,"
|
||||
" actions, profile_tag"
|
||||
" FROM event_push_actions"
|
||||
" WHERE user_id = ? %s"
|
||||
" ORDER BY stream_ordering DESC"
|
||||
" LIMIT ?"
|
||||
% (before_clause,)
|
||||
)
|
||||
txn.execute(sql, args)
|
||||
return self.cursor_to_dict(txn)
|
||||
|
||||
push_actions = yield self.runInteraction(
|
||||
"get_push_actions_for_user", f
|
||||
)
|
||||
for pa in push_actions:
|
||||
pa["actions"] = json.loads(pa["actions"])
|
||||
defer.returnValue(push_actions)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def get_time_of_last_push_action_before(self, stream_ordering):
|
||||
def f(txn):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue