mirror of
https://github.com/element-hq/synapse
synced 2024-08-19 06:50:52 +00:00
Bump a user's presence last_active time every time they send a message to a room
This commit is contained in:
parent
59d3955db1
commit
1c6ab2d759
2 changed files with 10 additions and 0 deletions
|
@ -90,6 +90,10 @@ class MessageHandler(BaseRoomHandler):
|
||||||
|
|
||||||
yield self._on_new_room_event(event, snapshot)
|
yield self._on_new_room_event(event, snapshot)
|
||||||
|
|
||||||
|
self.hs.get_handlers().presence_handler.bump_presence_active_time(
|
||||||
|
user
|
||||||
|
)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def get_messages(self, user_id=None, room_id=None, pagin_config=None,
|
def get_messages(self, user_id=None, room_id=None, pagin_config=None,
|
||||||
feedback=False):
|
feedback=False):
|
||||||
|
|
|
@ -266,6 +266,12 @@ class PresenceHandler(BaseHandler):
|
||||||
# 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)
|
self.changed_presencelike_data(target_user, state)
|
||||||
|
|
||||||
|
def bump_presence_active_time(self, user, now=None):
|
||||||
|
if now is None:
|
||||||
|
now = self.clock.time_msec()
|
||||||
|
|
||||||
|
self.changed_presencelike_data(user, {"last_active": now})
|
||||||
|
|
||||||
def changed_presencelike_data(self, user, state):
|
def changed_presencelike_data(self, user, state):
|
||||||
statuscache = self._get_or_make_usercache(user)
|
statuscache = self._get_or_make_usercache(user)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue