Properly handle presence events for application services. (#8656)

This commit is contained in:
Patrick Cloke 2020-10-26 09:19:07 -04:00 committed by GitHub
parent 437a99fb99
commit 5eda018561
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

1
changelog.d/8656.bugfix Normal file
View File

@ -0,0 +1 @@
Fix a bug introduced in v1.22.0rc1 where presence events were not properly passed to application services.

View File

@ -238,7 +238,7 @@ class ApplicationServicesHandler:
async def _handle_presence(
self, service: ApplicationService, users: Collection[UserID]
):
) -> List[JsonDict]:
events = [] # type: List[JsonDict]
presence_source = self.event_sources.sources["presence"]
from_key = await self.store.get_type_stream_id_for_appservice(
@ -252,7 +252,7 @@ class ApplicationServicesHandler:
user=user, service=service, from_key=from_key,
)
time_now = self.clock.time_msec()
presence_events = [
events.extend(
{
"type": "m.presence",
"sender": event.user_id,
@ -261,8 +261,9 @@ class ApplicationServicesHandler:
),
}
for event in presence_events
]
events = events + presence_events
)
return events
async def query_user_exists(self, user_id):
"""Check if any application service knows this user_id exists.