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

Commit 3d1661f

Browse files
committed
rename recipient_user_id_device_id_to_messages -> recipient_device_to_messages
1 parent e7f6732 commit 3d1661f

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

synapse/handlers/appservice.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ async def _get_to_device_messages(
510510
return []
511511

512512
# Retrieve the to-device messages for each user
513-
recipient_user_id_device_id_to_messages = await self.store.get_new_messages(
513+
recipient_device_to_messages = await self.store.get_new_messages(
514514
users_appservice_is_interested_in,
515515
from_key,
516516
new_token,
@@ -526,7 +526,7 @@ async def _get_to_device_messages(
526526
for (
527527
user_id,
528528
device_id,
529-
), messages in recipient_user_id_device_id_to_messages.items():
529+
), messages in recipient_device_to_messages.items():
530530
for message_json in messages:
531531
# Remove 'message_id' from the to-device message, as it's an internal ID
532532
message_json.pop("message_id", None)

synapse/storage/databases/main/deviceinbox.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -191,20 +191,18 @@ def get_new_messages_txn(txn: LoggingTransaction):
191191

192192
# Create a dictionary of (user ID, device ID) -> list of messages that
193193
# that device is meant to receive.
194-
recipient_user_id_device_id_to_messages: Dict[
195-
Tuple[str, str], List[JsonDict]
196-
] = {}
194+
recipient_device_to_messages: Dict[Tuple[str, str], List[JsonDict]] = {}
197195

198196
for row in txn:
199197
recipient_user_id = row[0]
200198
recipient_device_id = row[1]
201199
message_dict = db_to_json(row[2])
202200

203-
recipient_user_id_device_id_to_messages.setdefault(
201+
recipient_device_to_messages.setdefault(
204202
(recipient_user_id, recipient_device_id), []
205203
).append(message_dict)
206204

207-
return recipient_user_id_device_id_to_messages
205+
return recipient_device_to_messages
208206

209207
return await self.db_pool.runInteraction(
210208
"get_new_messages", get_new_messages_txn

0 commit comments

Comments
 (0)