diff --git a/changelog.d/13235.bugfix b/changelog.d/13235.bugfix new file mode 100644 index 000000000000..5c31fbc7755d --- /dev/null +++ b/changelog.d/13235.bugfix @@ -0,0 +1 @@ +Fix MSC3202-enabled appservices not receiving to-device messages, preventing messages from being decrypted. \ No newline at end of file diff --git a/synapse/appservice/scheduler.py b/synapse/appservice/scheduler.py index de5e5216c223..edaf3b2c2ca6 100644 --- a/synapse/appservice/scheduler.py +++ b/synapse/appservice/scheduler.py @@ -329,8 +329,9 @@ async def _compute_msc3202_otk_counts_and_fallback_keys( ) # Add recipients of to-device messages. - # device_message["user_id"] is the ID of the recipient. - users.update(device_message["user_id"] for device_message in to_device_messages) + users.update( + device_message["to_user_id"] for device_message in to_device_messages + ) # Compute and return the counts / fallback key usage states otk_counts = await self._store.count_bulk_e2e_one_time_keys_for_as(users)