summary refs log tree commit diff
path: root/synapse/handlers/presence.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2016-08-30 15:51:28 +0100
committerGitHub <noreply@github.com>2016-08-30 15:51:28 +0100
commitd3f108b6bb1784f860732d95cc85fa5e4afc63b5 (patch)
tree3b1657ff925cb8a7f8d479e218ed6b247fca61f2 /synapse/handlers/presence.py
parentRemove FUD over psql (diff)
parentDon't notify for online -> online transitions. (diff)
downloadsynapse-d3f108b6bb1784f860732d95cc85fa5e4afc63b5.tar.xz
Merge pull request #1054 from matrix-org/erikj/presence_noop_online
Don't notify for online -> online transitions.
Diffstat (limited to 'synapse/handlers/presence.py')
-rw-r--r--synapse/handlers/presence.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/synapse/handlers/presence.py b/synapse/handlers/presence.py
index 73752b2f89..b5a3bcd660 100644
--- a/synapse/handlers/presence.py
+++ b/synapse/handlers/presence.py
@@ -922,7 +922,12 @@ def should_notify(old_state, new_state):
         if new_state.currently_active != old_state.currently_active:
             return True
 
-    if new_state.last_active_ts - old_state.last_active_ts > LAST_ACTIVE_GRANULARITY:
+        if new_state.last_active_ts - old_state.last_active_ts > LAST_ACTIVE_GRANULARITY:
+            # Only notify about last active bumps if we're not currently acive
+            if not (old_state.currently_active and new_state.currently_active):
+                return True
+
+    elif new_state.last_active_ts - old_state.last_active_ts > LAST_ACTIVE_GRANULARITY:
         # Always notify for a transition where last active gets bumped.
         return True