Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Do not add groups to sync results if disabled. (#12408)
Browse files Browse the repository at this point in the history
  • Loading branch information
clokep authored Apr 7, 2022
1 parent d1cd96c commit 1a90c1e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions changelog.d/12408.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Do not include groups in the sync response when disabled.
5 changes: 3 additions & 2 deletions synapse/handlers/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -1155,8 +1155,9 @@ async def generate_sync_result(
await self.store.get_e2e_unused_fallback_key_types(user_id, device_id)
)

logger.debug("Fetching group data")
await self._generate_sync_entry_for_groups(sync_result_builder)
if self.hs_config.experimental.groups_enabled:
logger.debug("Fetching group data")
await self._generate_sync_entry_for_groups(sync_result_builder)

num_events = 0

Expand Down
15 changes: 7 additions & 8 deletions synapse/rest/client/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,14 +301,13 @@ async def encode_response(
if archived:
response["rooms"][Membership.LEAVE] = archived

# By the time we get here groups is no longer optional.
assert sync_result.groups is not None
if sync_result.groups.join:
response["groups"][Membership.JOIN] = sync_result.groups.join
if sync_result.groups.invite:
response["groups"][Membership.INVITE] = sync_result.groups.invite
if sync_result.groups.leave:
response["groups"][Membership.LEAVE] = sync_result.groups.leave
if sync_result.groups is not None:
if sync_result.groups.join:
response["groups"][Membership.JOIN] = sync_result.groups.join
if sync_result.groups.invite:
response["groups"][Membership.INVITE] = sync_result.groups.invite
if sync_result.groups.leave:
response["groups"][Membership.LEAVE] = sync_result.groups.leave

return response

Expand Down

0 comments on commit 1a90c1e

Please sign in to comment.