Don't set currently_active for remote presence

This commit is contained in:
Erik Johnston 2016-02-19 10:58:27 +00:00
parent 5f4eca3816
commit 929cb0ed7d
2 changed files with 27 additions and 10 deletions

View file

@ -995,6 +995,18 @@ def handle_update(prev_state, new_state, is_mine, wheel_timer, now):
then=new_state.last_active_ts + IDLE_TIMER
)
active = now - new_state.last_active_ts < LAST_ACTIVE_GRANULARITY
new_state = new_state.copy_and_replace(
currently_active=active,
)
if active:
wheel_timer.insert(
now=now,
obj=user_id,
then=new_state.last_active_ts + LAST_ACTIVE_GRANULARITY
)
if new_state.state != PresenceState.OFFLINE:
# User has stopped syncing
wheel_timer.insert(
@ -1018,12 +1030,6 @@ def handle_update(prev_state, new_state, is_mine, wheel_timer, now):
then=new_state.last_federation_update_ts + FEDERATION_TIMEOUT
)
if new_state.state == PresenceState.ONLINE:
active = now - new_state.last_active_ts < LAST_ACTIVE_GRANULARITY
new_state = new_state.copy_and_replace(
currently_active=active,
)
# Check whether the change was something worth notifying about
if should_notify(prev_state, new_state):
new_state = new_state.copy_and_replace(