mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Merge pull request #810 from matrix-org/dbkr/limit_email_notifs
Limit number of notifications in an email notification
This commit is contained in:
commit
1db79d6192
@ -119,7 +119,8 @@ class EventPushActionsStore(SQLBaseStore):
|
|||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def get_unread_push_actions_for_user_in_range(self, user_id,
|
def get_unread_push_actions_for_user_in_range(self, user_id,
|
||||||
min_stream_ordering,
|
min_stream_ordering,
|
||||||
max_stream_ordering=None):
|
max_stream_ordering=None,
|
||||||
|
limit=20):
|
||||||
def get_after_receipt(txn):
|
def get_after_receipt(txn):
|
||||||
sql = (
|
sql = (
|
||||||
"SELECT ep.event_id, ep.room_id, ep.stream_ordering, ep.actions, "
|
"SELECT ep.event_id, ep.room_id, ep.stream_ordering, ep.actions, "
|
||||||
@ -151,7 +152,8 @@ class EventPushActionsStore(SQLBaseStore):
|
|||||||
if max_stream_ordering is not None:
|
if max_stream_ordering is not None:
|
||||||
sql += " AND ep.stream_ordering <= ?"
|
sql += " AND ep.stream_ordering <= ?"
|
||||||
args.append(max_stream_ordering)
|
args.append(max_stream_ordering)
|
||||||
sql += " ORDER BY ep.stream_ordering ASC"
|
sql += " ORDER BY ep.stream_ordering ASC LIMIT ?"
|
||||||
|
args.append(limit)
|
||||||
txn.execute(sql, args)
|
txn.execute(sql, args)
|
||||||
return txn.fetchall()
|
return txn.fetchall()
|
||||||
after_read_receipt = yield self.runInteraction(
|
after_read_receipt = yield self.runInteraction(
|
||||||
|
Loading…
Reference in New Issue
Block a user