summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-08-30 15:00:14 +0100
committerErik Johnston <erik@matrix.org>2016-08-30 15:05:32 +0100
commitbc1a8b1f7acd6cddcd46110d37706f0163004ecf (patch)
treee02966c41d47c4c64f5a5b086679d230f25006f0 /synapse/handlers
parentMerge pull request #1051 from matrix-org/erikj/fix_push_names (diff)
downloadsynapse-bc1a8b1f7acd6cddcd46110d37706f0163004ecf.tar.xz
Don't notify for online -> online transitions.
Specifically, if currently_active remains true then we should not notify
if only the last active time changes.
Diffstat (limited to 'synapse/handlers')
-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