Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Destructure output tuples into named variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Fizzadar committed Aug 23, 2022
1 parent 55f587c commit b7a66e3
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions synapse/storage/databases/main/event_push_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,15 +538,15 @@ def get_push_actions_txn(

notifs = [
HttpPushAction(
event_id=row[0],
room_id=row[1],
stream_ordering=row[2],
actions=_deserialize_action(row[3], row[4]),
event_id=event_id,
room_id=room_id,
stream_ordering=stream_ordering,
actions=_deserialize_action(actions, highlight),
)
for row in push_actions
for event_id, room_id, stream_ordering, actions, highlight in push_actions
# Only include push actions with a stream ordering after any receipt, or without any
# receipt present (invited to but never read rooms).
if row[2] > receipts_by_room.get(row[1], 0)
if stream_ordering > receipts_by_room.get(room_id, 0)
]

# Now sort it so it's ordered correctly, since currently it will
Expand Down Expand Up @@ -615,16 +615,16 @@ def get_push_actions_txn(
# Make a list of dicts from the two sets of results.
notifs = [
EmailPushAction(
event_id=row[0],
room_id=row[1],
stream_ordering=row[2],
actions=_deserialize_action(row[3], row[4]),
received_ts=row[5],
event_id=event_id,
room_id=room_id,
stream_ordering=stream_ordering,
actions=_deserialize_action(actions, highlight),
received_ts=received_ts,
)
for row in push_actions
for event_id, room_id, stream_ordering, actions, highlight, received_ts in push_actions
# Only include push actions with a stream ordering after any receipt, or without any
# receipt present (invited to but never read rooms).
if row[2] > receipts_by_room.get(row[1], 0)
if stream_ordering > receipts_by_room.get(room_id, 0)
]

# Now sort it so it's ordered correctly, since currently it will
Expand Down

0 comments on commit b7a66e3

Please sign in to comment.