Merge pull request #997 from Half-Shot/develop
Don't change status_msg on /sync
This commit is contained in:
commit
832799dbff
|
@ -119,7 +119,7 @@ class SynchrotronPresence(object):
|
||||||
|
|
||||||
reactor.addSystemEventTrigger("before", "shutdown", self._on_shutdown)
|
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?
|
# TODO Hows this supposed to work?
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -672,7 +672,7 @@ class PresenceHandler(object):
|
||||||
])
|
])
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@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.
|
"""Set the presence state of the user.
|
||||||
"""
|
"""
|
||||||
status_msg = state.get("status_msg", None)
|
status_msg = state.get("status_msg", None)
|
||||||
|
@ -689,10 +689,13 @@ class PresenceHandler(object):
|
||||||
prev_state = yield self.current_state_for_user(user_id)
|
prev_state = yield self.current_state_for_user(user_id)
|
||||||
|
|
||||||
new_fields = {
|
new_fields = {
|
||||||
"state": presence,
|
"state": presence
|
||||||
"status_msg": status_msg if presence != PresenceState.OFFLINE else None
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if not ignore_status_msg:
|
||||||
|
msg = status_msg if presence != PresenceState.OFFLINE else None
|
||||||
|
new_fields["status_msg"] = msg
|
||||||
|
|
||||||
if presence == PresenceState.ONLINE:
|
if presence == PresenceState.ONLINE:
|
||||||
new_fields["last_active_ts"] = self.clock.time_msec()
|
new_fields["last_active_ts"] = self.clock.time_msec()
|
||||||
|
|
||||||
|
|
|
@ -146,7 +146,7 @@ class SyncRestServlet(RestServlet):
|
||||||
affect_presence = set_presence != PresenceState.OFFLINE
|
affect_presence = set_presence != PresenceState.OFFLINE
|
||||||
|
|
||||||
if affect_presence:
|
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(
|
context = yield self.presence_handler.user_syncing(
|
||||||
user.to_string(), affect_presence=affect_presence,
|
user.to_string(), affect_presence=affect_presence,
|
||||||
|
|
Loading…
Reference in New Issue