diff options
author | Erik Johnston <erikj@jki.re> | 2016-08-11 14:10:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-11 14:10:55 +0100 |
commit | 832799dbff31d085733ea56c54bcb8aab8799366 (patch) | |
tree | 5b61045e8c7174cb178b1f1b48de42e6d69ca67c | |
parent | Merge pull request #1003 from matrix-org/erikj/redaction_prev_content (diff) | |
parent | Synced up synchrotron set_state with PresenceHandler set_state (diff) | |
download | synapse-832799dbff31d085733ea56c54bcb8aab8799366.tar.xz |
Merge pull request #997 from Half-Shot/develop
Don't change status_msg on /sync
-rw-r--r-- | synapse/app/synchrotron.py | 2 | ||||
-rw-r--r-- | synapse/handlers/presence.py | 9 | ||||
-rw-r--r-- | synapse/rest/client/v2_alpha/sync.py | 2 |
3 files changed, 8 insertions, 5 deletions
diff --git a/synapse/app/synchrotron.py b/synapse/app/synchrotron.py index 215ccfd522..48bc97636c 100644 --- a/synapse/app/synchrotron.py +++ b/synapse/app/synchrotron.py @@ -119,7 +119,7 @@ class SynchrotronPresence(object): reactor.addSystemEventTrigger("before", "shutdown", self._on_shutdown) - def set_state(self, user, state): + def set_state(self, user, state, ignore_status_msg=False): # TODO Hows this supposed to work? pass diff --git a/synapse/handlers/presence.py b/synapse/handlers/presence.py index 6b70fa3817..2293b5fdf7 100644 --- a/synapse/handlers/presence.py +++ b/synapse/handlers/presence.py @@ -672,7 +672,7 @@ class PresenceHandler(object): ]) @defer.inlineCallbacks - def set_state(self, target_user, state): + def set_state(self, target_user, state, ignore_status_msg=False): """Set the presence state of the user. """ status_msg = state.get("status_msg", None) @@ -689,10 +689,13 @@ class PresenceHandler(object): prev_state = yield self.current_state_for_user(user_id) new_fields = { - "state": presence, - "status_msg": status_msg if presence != PresenceState.OFFLINE else None + "state": presence } + if not ignore_status_msg: + msg = status_msg if presence != PresenceState.OFFLINE else None + new_fields["status_msg"] = msg + if presence == PresenceState.ONLINE: new_fields["last_active_ts"] = self.clock.time_msec() diff --git a/synapse/rest/client/v2_alpha/sync.py b/synapse/rest/client/v2_alpha/sync.py index 43d8e0bf39..b11acdbea7 100644 --- a/synapse/rest/client/v2_alpha/sync.py +++ b/synapse/rest/client/v2_alpha/sync.py @@ -146,7 +146,7 @@ class SyncRestServlet(RestServlet): affect_presence = set_presence != PresenceState.OFFLINE if affect_presence: - yield self.presence_handler.set_state(user, {"presence": set_presence}) + yield self.presence_handler.set_state(user, {"presence": set_presence}, True) context = yield self.presence_handler.user_syncing( user.to_string(), affect_presence=affect_presence, |