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

Commit 1a90c1e

Browse files
authored
Do not add groups to sync results if disabled. (#12408)
1 parent d1cd96c commit 1a90c1e

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

changelog.d/12408.misc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Do not include groups in the sync response when disabled.

synapse/handlers/sync.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1155,8 +1155,9 @@ async def generate_sync_result(
11551155
await self.store.get_e2e_unused_fallback_key_types(user_id, device_id)
11561156
)
11571157

1158-
logger.debug("Fetching group data")
1159-
await self._generate_sync_entry_for_groups(sync_result_builder)
1158+
if self.hs_config.experimental.groups_enabled:
1159+
logger.debug("Fetching group data")
1160+
await self._generate_sync_entry_for_groups(sync_result_builder)
11601161

11611162
num_events = 0
11621163

synapse/rest/client/sync.py

+7-8
Original file line numberDiff line numberDiff line change
@@ -301,14 +301,13 @@ async def encode_response(
301301
if archived:
302302
response["rooms"][Membership.LEAVE] = archived
303303

304-
# By the time we get here groups is no longer optional.
305-
assert sync_result.groups is not None
306-
if sync_result.groups.join:
307-
response["groups"][Membership.JOIN] = sync_result.groups.join
308-
if sync_result.groups.invite:
309-
response["groups"][Membership.INVITE] = sync_result.groups.invite
310-
if sync_result.groups.leave:
311-
response["groups"][Membership.LEAVE] = sync_result.groups.leave
304+
if sync_result.groups is not None:
305+
if sync_result.groups.join:
306+
response["groups"][Membership.JOIN] = sync_result.groups.join
307+
if sync_result.groups.invite:
308+
response["groups"][Membership.INVITE] = sync_result.groups.invite
309+
if sync_result.groups.leave:
310+
response["groups"][Membership.LEAVE] = sync_result.groups.leave
312311

313312
return response
314313

0 commit comments

Comments
 (0)