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

Commit

Permalink
Clean up some docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
anoadragon453 committed Nov 4, 2021
1 parent 7bf663a commit 5d70b68
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 22 deletions.
25 changes: 7 additions & 18 deletions synapse/handlers/appservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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
)
Expand All @@ -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(
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 0 additions & 4 deletions synapse/handlers/receipts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 5d70b68

Please sign in to comment.