From 1a90c1e3af71fe57c5a4bce52c60e6cd7509b0c2 Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Thu, 7 Apr 2022 09:29:56 -0400 Subject: Do not add groups to sync results if disabled. (#12408) --- synapse/rest/client/sync.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'synapse/rest/client') diff --git a/synapse/rest/client/sync.py b/synapse/rest/client/sync.py index 0bf32f873b..2e25e8638b 100644 --- a/synapse/rest/client/sync.py +++ b/synapse/rest/client/sync.py @@ -301,14 +301,13 @@ class SyncRestServlet(RestServlet): 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 -- cgit 1.4.1