summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrew Morgan <1342360+anoadragon453@users.noreply.github.com>2020-05-15 11:44:00 +0100
committerGitHub <noreply@github.com>2020-05-15 11:44:00 +0100
commit02d97fc3baa8056c7ef823f98d114e307979d9cc (patch)
tree84ed79f5b2d286add86585a304ccfcb2973694b9
parentStrictly enforce canonicaljson requirements in a new room version (#7381) (diff)
downloadsynapse-02d97fc3baa8056c7ef823f98d114e307979d9cc.tar.xz
Ignore incoming presence updates when presence is disabled (#7508)
Diffstat (limited to '')
-rw-r--r--changelog.d/7508.bugfix1
-rw-r--r--synapse/handlers/presence.py6
2 files changed, 5 insertions, 2 deletions
diff --git a/changelog.d/7508.bugfix b/changelog.d/7508.bugfix
new file mode 100644
index 0000000000..c78e77c631
--- /dev/null
+++ b/changelog.d/7508.bugfix
@@ -0,0 +1 @@
+Ignore incoming presence events from other homeservers if presence is disabled locally.
\ No newline at end of file
diff --git a/synapse/handlers/presence.py b/synapse/handlers/presence.py
index 5cbefae177..9ea11c0754 100644
--- a/synapse/handlers/presence.py
+++ b/synapse/handlers/presence.py
@@ -204,6 +204,7 @@ class PresenceHandler(BasePresenceHandler):
         self.notifier = hs.get_notifier()
         self.federation = hs.get_federation_sender()
         self.state = hs.get_state_handler()
+        self._presence_enabled = hs.config.use_presence
 
         federation_registry = hs.get_federation_registry()
 
@@ -676,13 +677,14 @@ class PresenceHandler(BasePresenceHandler):
     async def incoming_presence(self, origin, content):
         """Called when we receive a `m.presence` EDU from a remote server.
         """
+        if not self._presence_enabled:
+            return
+
         now = self.clock.time_msec()
         updates = []
         for push in content.get("push", []):
             # A "push" contains a list of presence that we are probably interested
             # in.
-            # TODO: Actually check if we're interested, rather than blindly
-            # accepting presence updates.
             user_id = push.get("user_id", None)
             if not user_id:
                 logger.info(