Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Ley
synapse
Commits
066c7037
Unverified
Commit
066c7037
authored
4 years ago
by
Brendan Abolivier
Browse files
Options
Downloads
Patches
Plain Diff
Move support for MSC3026 behind an experimental flag
parent
405aeb0b
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
synapse/app/generic_worker.py
+6
-1
6 additions, 1 deletion
synapse/app/generic_worker.py
synapse/config/experimental.py
+2
-0
2 additions, 0 deletions
synapse/config/experimental.py
synapse/handlers/presence.py
+10
-2
10 additions, 2 deletions
synapse/handlers/presence.py
with
18 additions
and
3 deletions
synapse/app/generic_worker.py
+
6
−
1
View file @
066c7037
...
@@ -302,6 +302,8 @@ class GenericWorkerPresence(BasePresenceHandler):
...
@@ -302,6 +302,8 @@ class GenericWorkerPresence(BasePresenceHandler):
self
.
send_stop_syncing
,
UPDATE_SYNCING_USERS_MS
self
.
send_stop_syncing
,
UPDATE_SYNCING_USERS_MS
)
)
self
.
_busy_presence_enabled
=
hs
.
config
.
experimental
.
msc3026_enabled
hs
.
get_reactor
().
addSystemEventTrigger
(
hs
.
get_reactor
().
addSystemEventTrigger
(
"
before
"
,
"
before
"
,
"
shutdown
"
,
"
shutdown
"
,
...
@@ -439,8 +441,11 @@ class GenericWorkerPresence(BasePresenceHandler):
...
@@ -439,8 +441,11 @@ class GenericWorkerPresence(BasePresenceHandler):
PresenceState
.
ONLINE
,
PresenceState
.
ONLINE
,
PresenceState
.
UNAVAILABLE
,
PresenceState
.
UNAVAILABLE
,
PresenceState
.
OFFLINE
,
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
:
raise
SynapseError
(
400
,
"
Invalid presence state
"
)
raise
SynapseError
(
400
,
"
Invalid presence state
"
)
...
...
This diff is collapsed.
Click to expand it.
synapse/config/experimental.py
+
2
−
0
View file @
066c7037
...
@@ -27,3 +27,5 @@ class ExperimentalConfig(Config):
...
@@ -27,3 +27,5 @@ class ExperimentalConfig(Config):
# MSC2858 (multiple SSO identity providers)
# MSC2858 (multiple SSO identity providers)
self
.
msc2858_enabled
=
experimental
.
get
(
"
msc2858_enabled
"
,
False
)
# type: bool
self
.
msc2858_enabled
=
experimental
.
get
(
"
msc2858_enabled
"
,
False
)
# type: bool
# MSC3026 (busy presence state)
self
.
msc3026_enabled
=
experimental
.
get
(
"
msc3026_enabled
"
,
False
)
# type: bool
This diff is collapsed.
Click to expand it.
synapse/handlers/presence.py
+
10
−
2
View file @
066c7037
...
@@ -104,6 +104,8 @@ class BasePresenceHandler(abc.ABC):
...
@@ -104,6 +104,8 @@ class BasePresenceHandler(abc.ABC):
self
.
clock
=
hs
.
get_clock
()
self
.
clock
=
hs
.
get_clock
()
self
.
store
=
hs
.
get_datastore
()
self
.
store
=
hs
.
get_datastore
()
self
.
_busy_presence_enabled
=
hs
.
config
.
experimental
.
msc3026_enabled
active_presence
=
self
.
store
.
take_presence_startup_info
()
active_presence
=
self
.
store
.
take_presence_startup_info
()
self
.
user_to_current_state
=
{
state
.
user_id
:
state
for
state
in
active_presence
}
self
.
user_to_current_state
=
{
state
.
user_id
:
state
for
state
in
active_presence
}
...
@@ -730,8 +732,11 @@ class PresenceHandler(BasePresenceHandler):
...
@@ -730,8 +732,11 @@ class PresenceHandler(BasePresenceHandler):
PresenceState
.
ONLINE
,
PresenceState
.
ONLINE
,
PresenceState
.
UNAVAILABLE
,
PresenceState
.
UNAVAILABLE
,
PresenceState
.
OFFLINE
,
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
:
raise
SynapseError
(
400
,
"
Invalid presence state
"
)
raise
SynapseError
(
400
,
"
Invalid presence state
"
)
...
@@ -745,7 +750,10 @@ class PresenceHandler(BasePresenceHandler):
...
@@ -745,7 +750,10 @@ class PresenceHandler(BasePresenceHandler):
msg
=
status_msg
if
presence
!=
PresenceState
.
OFFLINE
else
None
msg
=
status_msg
if
presence
!=
PresenceState
.
OFFLINE
else
None
new_fields
[
"
status_msg
"
]
=
msg
new_fields
[
"
status_msg
"
]
=
msg
if
presence
==
PresenceState
.
ONLINE
or
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
()
new_fields
[
"
last_active_ts
"
]
=
self
.
clock
.
time_msec
()
await
self
.
_update_states
([
prev_state
.
copy_and_replace
(
**
new_fields
)])
await
self
.
_update_states
([
prev_state
.
copy_and_replace
(
**
new_fields
)])
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment