Refactor _set_push_actions_for_event_and_users_txn to use events_and_contexts

This commit is contained in:
Erik Johnston 2018-02-20 12:29:50 +00:00
parent 324c3e9399
commit ad0ccf15ea
2 changed files with 42 additions and 34 deletions

View file

@ -1162,16 +1162,17 @@ class EventsStore(SQLBaseStore):
backfilled (bool): True if the events were backfilled
"""
# Insert all the push actions into the event_push_actions table.
self._set_push_actions_for_event_and_users_txn(
txn,
events_and_contexts=events_and_contexts,
)
if not events_and_contexts:
# nothing to do here
return
for event, context in events_and_contexts:
# Insert all the push actions into the event_push_actions table.
self._set_push_actions_for_event_and_users_txn(
txn, event,
)
if event.type == EventTypes.Redaction and event.redacts is not None:
# Remove the entries in the event_push_actions table for the
# redacted event.