summary refs log tree commit diff
path: root/synapse/app/generic_worker.py
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2021-03-22 14:28:19 +0100
committerGitHub <noreply@github.com>2021-03-22 14:28:19 +0100
commite09838c78fe63a7d702ac87dca8365310457bef5 (patch)
treee4877c8022cda6b7953edc8066a6af8dc329082a /synapse/app/generic_worker.py
parentfix mypy (diff)
parentIncorporate review (diff)
downloadsynapse-e09838c78fe63a7d702ac87dca8365310457bef5.tar.xz
Merge pull request #9644 from matrix-org/babolivier/msc3026
Implement MSC3026: busy presence state
Diffstat (limited to 'synapse/app/generic_worker.py')
-rw-r--r--synapse/app/generic_worker.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/synapse/app/generic_worker.py b/synapse/app/generic_worker.py

index 274d582d07..caef394e1d 100644 --- a/synapse/app/generic_worker.py +++ b/synapse/app/generic_worker.py
@@ -302,6 +302,8 @@ class GenericWorkerPresence(BasePresenceHandler): self.send_stop_syncing, UPDATE_SYNCING_USERS_MS ) + self._busy_presence_enabled = hs.config.experimental.msc3026_enabled + hs.get_reactor().addSystemEventTrigger( "before", "shutdown", @@ -439,8 +441,12 @@ class GenericWorkerPresence(BasePresenceHandler): PresenceState.ONLINE, PresenceState.UNAVAILABLE, PresenceState.OFFLINE, + 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()