diff --git a/synapse/handlers/appservice.py b/synapse/handlers/appservice.py index 96cc251676d4..985f68909172 100644 --- a/synapse/handlers/appservice.py +++ b/synapse/handlers/appservice.py @@ -205,14 +205,12 @@ def notify_interested_services_ephemeral( users: Collection[Union[str, UserID]], ) -> None: """ - This is called by the notifier in the background when - an ephemeral event is handled by the homeserver. + This is called by the notifier in the background when an ephemeral event is handled + by the homeserver. - This will determine which appservices are - interested in the event, and submit them. + This will determine which appservices are interested in the event, and submit them. - Events will only be pushed to appservices - that have opted into ephemeral events + Events will only be pushed to appservices that have opted into ephemeral events Args: stream_key: The stream the event came from. @@ -225,7 +223,7 @@ def notify_interested_services_ephemeral( `msc2409_to_device_messages_enabled` config option is set to true. Ephemeral events will only be pushed to appservices that have opted into - them. + them with the ephemeral registration file option enabled. Appservices will only receive ephemeral events that fall within their registered user and room namespaces. @@ -345,7 +343,7 @@ async def _notify_interested_services_ephemeral( and self.msc2409_to_device_messages_enabled ): # Retrieve an iterable of to-device message events, as well as the - # maximum stream token we were able to retrieve. + # maximum stream token of the messages we were able to retrieve. events, max_stream_token = await self._handle_to_device( service, new_token, users ) @@ -356,6 +354,7 @@ async def _notify_interested_services_ephemeral( # TODO: If max_stream_token != new_token, schedule another transaction immediately, # instead of waiting for another to-device to be sent? + # https://github.com/matrix-org/synapse/issues/11150#issuecomment-960726449 # Persist the latest handled stream token for this appservice await self.store.set_type_stream_id_for_appservice( @@ -416,16 +415,6 @@ async def _handle_to_device( limit=MAX_TO_DEVICE_MESSAGES_PER_AS_TRANSACTION, ) - logger.info( - "*** Users: %s, from: %s, to: %s", - users_appservice_is_interested_in, - from_key, - new_token, - ) - logger.info( - "*** Got to-device message: %s", recipient_user_id_device_id_to_messages - ) - # According to MSC2409, we'll need to add 'to_user_id' and 'to_device_id' fields # to the event JSON so that the application service will know which user/device # combination this messages was intended for. diff --git a/synapse/handlers/receipts.py b/synapse/handlers/receipts.py index 9fe980e72a94..4911a1153519 100644 --- a/synapse/handlers/receipts.py +++ b/synapse/handlers/receipts.py @@ -267,10 +267,6 @@ async def get_new_events_as( ) # Then filter down to rooms that the AS can read - # TODO: This doesn't seem to honour an appservice's registration of room or - # namespace aliases. For instance, if an appservice registered a room namespace - # that matched this room, but it didn't have any members in the room, then that - # appservice wouldn't receive the read receipt. events = [] for room_id, event in rooms_to_events.items(): if not await service.matches_user_in_member_list(room_id, self.store):