diff options
author | Amber H. Brown <hawkowl@atleastfornow.net> | 2019-07-26 21:35:42 +1000 |
---|---|---|
committer | Amber H. Brown <hawkowl@atleastfornow.net> | 2019-07-26 21:35:42 +1000 |
commit | 8d9a56e0a6fc9fcf2bb9fdcf2ffd02ed06a5004d (patch) | |
tree | c1447febc3581a6f6e2c91ce3dd962dadae2f9e3 /synapse/handlers/receipts.py | |
parent | fix merging forward (diff) | |
parent | Merge tag 'v1.2.1' into shhs (diff) | |
download | synapse-8d9a56e0a6fc9fcf2bb9fdcf2ffd02ed06a5004d.tar.xz |
Merge branch 'shhs' of ssh://github.com/matrix-org/synapse into shhs shhs-v1.2.1.1 github/shhs shhs
Diffstat (limited to 'synapse/handlers/receipts.py')
-rw-r--r-- | synapse/handlers/receipts.py | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/synapse/handlers/receipts.py b/synapse/handlers/receipts.py index a85dd8cdee..e58bf7e360 100644 --- a/synapse/handlers/receipts.py +++ b/synapse/handlers/receipts.py @@ -17,7 +17,7 @@ import logging from twisted.internet import defer from synapse.handlers._base import BaseHandler -from synapse.types import ReadReceipt +from synapse.types import ReadReceipt, get_domain_from_id logger = logging.getLogger(__name__) @@ -40,18 +40,27 @@ class ReceiptsHandler(BaseHandler): def _received_remote_receipt(self, origin, content): """Called when we receive an EDU of type m.receipt from a remote HS. """ - receipts = [ - ReadReceipt( - room_id=room_id, - receipt_type=receipt_type, - user_id=user_id, - event_ids=user_values["event_ids"], - data=user_values.get("data", {}), - ) - for room_id, room_values in content.items() - for receipt_type, users in room_values.items() - for user_id, user_values in users.items() - ] + receipts = [] + for room_id, room_values in content.items(): + for receipt_type, users in room_values.items(): + for user_id, user_values in users.items(): + if get_domain_from_id(user_id) != origin: + logger.info( + "Received receipt for user %r from server %s, ignoring", + user_id, + origin, + ) + continue + + receipts.append( + ReadReceipt( + room_id=room_id, + receipt_type=receipt_type, + user_id=user_id, + event_ids=user_values["event_ids"], + data=user_values.get("data", {}), + ) + ) yield self._handle_new_receipts(receipts) |