0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-14 21:23:50 +01:00
This commit is contained in:
Brendan Abolivier 2021-03-19 16:11:08 +01:00
parent 066c703729
commit 0b56481caa
No known key found for this signature in database
GPG key ID: 1E015C145F1916CD
2 changed files with 10 additions and 11 deletions

View file

@ -441,12 +441,12 @@ class GenericWorkerPresence(BasePresenceHandler):
PresenceState.ONLINE,
PresenceState.UNAVAILABLE,
PresenceState.OFFLINE,
PresenceState.BUSY,
)
if self._busy_presence_enabled:
valid_presence += (PresenceState.BUSY,)
if presence not in valid_presence:
if presence not in valid_presence or (
presence == PresenceState.BUSY and not self._busy_presence_enabled
):
raise SynapseError(400, "Invalid presence state")
user_id = target_user.to_string()

View file

@ -732,12 +732,12 @@ class PresenceHandler(BasePresenceHandler):
PresenceState.ONLINE,
PresenceState.UNAVAILABLE,
PresenceState.OFFLINE,
PresenceState.BUSY,
)
if self._busy_presence_enabled:
valid_presence += (PresenceState.BUSY,)
if presence not in valid_presence:
if presence not in valid_presence or (
presence == PresenceState.BUSY and not self._busy_presence_enabled
):
raise SynapseError(400, "Invalid presence state")
user_id = target_user.to_string()
@ -750,9 +750,8 @@ class PresenceHandler(BasePresenceHandler):
msg = status_msg if presence != PresenceState.OFFLINE else None
new_fields["status_msg"] = msg
if (
presence == PresenceState.ONLINE or
(self._busy_presence_enabled and presence == PresenceState.BUSY)
if presence == PresenceState.ONLINE or (
self._busy_presence_enabled and presence == PresenceState.BUSY
):
new_fields["last_active_ts"] = self.clock.time_msec()