Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed presence results not returning offline users on initial sync #17231

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/17231.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added configurable option to always include offline users in presence sync results. Contributed by @Michael-Hollister.
5 changes: 5 additions & 0 deletions docs/usage/configuration/config_documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ Example configuration:
```yaml
presence:
enabled: false
include_offline_users_on_sync: false
```

`enabled` can also be set to a special value of "untracked" which ignores updates
Expand All @@ -254,6 +255,10 @@ received via clients and federation, while still accepting updates from the

*The "untracked" option was added in Synapse 1.96.0.*

When clients perform an initial or `full_state` sync, presence results for offline users are
not included by default. Setting `include_offline_users_on_sync` to `true` will always include
offline users in the results. Defaults to false.

---
### `require_auth_for_profile_requests`

Expand Down
5 changes: 5 additions & 0 deletions synapse/config/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,11 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None:
# Whether to internally track presence, requires that presence is enabled,
self.track_presence = self.presence_enabled and presence_enabled != "untracked"

# Determines if presence results for offline users are included on initial/full sync
self.presence_include_offline_users_on_sync = presence_config.get(
"include_offline_users_on_sync", False
)

# Custom presence router module
# This is the legacy way of configuring it (the config should now be put in the modules section)
self.presence_router_module_class = None
Expand Down
6 changes: 5 additions & 1 deletion synapse/handlers/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -2290,7 +2290,11 @@ async def _generate_sync_entry_for_presence(
user=user,
from_key=presence_key,
is_guest=sync_config.is_guest,
include_offline=include_offline,
include_offline=(
True
if self.hs_config.server.presence_include_offline_users_on_sync
else include_offline
),
)
assert presence_key
sync_result_builder.now_token = now_token.copy_and_replace(
Expand Down
Loading