Skip to content

Commit 087f6eb

Browse files
committed
Always return all memberships for non-limited syncs
This is so that clients know if they can use a cached `/members` response or not.
1 parent fc6000c commit 087f6eb

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

synapse/handlers/sliding_sync/__init__.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,10 +1072,27 @@ async def get_room_sync_data(
10721072

10731073
# Update the required state filter so we pick up the new
10741074
# membership
1075-
for user_id in timeline_membership:
1076-
required_state_types.append(
1077-
(EventTypes.Member, user_id)
1078-
)
1075+
if limited or initial:
1076+
# If the timeline is limited, we only need to
1077+
# return the membership changes for people in
1078+
# the timeline.
1079+
for user_id in timeline_membership:
1080+
required_state_types.append(
1081+
(EventTypes.Member, user_id)
1082+
)
1083+
else:
1084+
# For non-limited timelines we always return all
1085+
# membership changes. This is so that clients
1086+
# who have fetched the full membership list
1087+
# already can continue to maintain it for
1088+
# non-limited syncs.
1089+
#
1090+
# This assumes that for non-limited syncs there
1091+
# won't be many membership changes that wouldn't
1092+
# have been included already (this can only
1093+
# happen if membership state was rolled back due
1094+
# to state resolution anyway).
1095+
required_state_types.append((EventTypes.Member, None))
10791096

10801097
# Add an explicit entry for each user in the timeline
10811098
#

0 commit comments

Comments
 (0)