mirror of
https://mau.dev/maunium/synapse.git
synced 2024-11-09 03:22:57 +01:00
Merge branch 'markjh/presence_races' into markjh/v2_sync_api
This commit is contained in:
commit
1a46daf621
1 changed files with 8 additions and 3 deletions
|
@ -378,7 +378,7 @@ class PresenceHandler(BaseHandler):
|
||||||
|
|
||||||
# TODO(paul): perform a presence push as part of start/stop poll so
|
# TODO(paul): perform a presence push as part of start/stop poll so
|
||||||
# we don't have to do this all the time
|
# we don't have to do this all the time
|
||||||
self.changed_presencelike_data(target_user, state)
|
yield self.changed_presencelike_data(target_user, state)
|
||||||
|
|
||||||
def bump_presence_active_time(self, user, now=None):
|
def bump_presence_active_time(self, user, now=None):
|
||||||
if now is None:
|
if now is None:
|
||||||
|
@ -422,12 +422,12 @@ class PresenceHandler(BaseHandler):
|
||||||
@log_function
|
@log_function
|
||||||
def started_user_eventstream(self, user):
|
def started_user_eventstream(self, user):
|
||||||
# TODO(paul): Use "last online" state
|
# TODO(paul): Use "last online" state
|
||||||
self.set_state(user, user, {"presence": PresenceState.ONLINE})
|
return self.set_state(user, user, {"presence": PresenceState.ONLINE})
|
||||||
|
|
||||||
@log_function
|
@log_function
|
||||||
def stopped_user_eventstream(self, user):
|
def stopped_user_eventstream(self, user):
|
||||||
# TODO(paul): Save current state as "last online" state
|
# TODO(paul): Save current state as "last online" state
|
||||||
self.set_state(user, user, {"presence": PresenceState.OFFLINE})
|
return self.set_state(user, user, {"presence": PresenceState.OFFLINE})
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def user_joined_room(self, user, room_id):
|
def user_joined_room(self, user, room_id):
|
||||||
|
@ -1263,6 +1263,11 @@ class UserPresenceCache(object):
|
||||||
self.state = {"presence": PresenceState.OFFLINE}
|
self.state = {"presence": PresenceState.OFFLINE}
|
||||||
self.serial = None
|
self.serial = None
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "UserPresenceCache(state=%r, serial=%r)" % (
|
||||||
|
self.state, self.serial
|
||||||
|
)
|
||||||
|
|
||||||
def update(self, state, serial):
|
def update(self, state, serial):
|
||||||
assert("mtime_age" not in state)
|
assert("mtime_age" not in state)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue