summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2020-10-26 09:19:07 -0400
committerGitHub <noreply@github.com>2020-10-26 09:19:07 -0400
commit5eda0185612be2e2c15eaba0a607442febd4a5a8 (patch)
tree604612fda9b74d36496e17c24bc7290103621113
parentFix user_daily_visits to not have duplicate rows for UA. (#8654) (diff)
downloadsynapse-5eda0185612be2e2c15eaba0a607442febd4a5a8.tar.xz
Properly handle presence events for application services. (#8656)
Diffstat (limited to '')
-rw-r--r--changelog.d/8656.bugfix1
-rw-r--r--synapse/handlers/appservice.py9
2 files changed, 6 insertions, 4 deletions
diff --git a/changelog.d/8656.bugfix b/changelog.d/8656.bugfix
new file mode 100644
index 0000000000..d6415e8282
--- /dev/null
+++ b/changelog.d/8656.bugfix
@@ -0,0 +1 @@
+Fix a bug introduced in v1.22.0rc1 where presence events were not properly passed to application services.
diff --git a/synapse/handlers/appservice.py b/synapse/handlers/appservice.py
index 07240d3a14..fe8cfc9b18 100644
--- a/synapse/handlers/appservice.py
+++ b/synapse/handlers/appservice.py
@@ -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.