@@ -1851,6 +1851,7 @@ async def _get_rooms_changed(
1851
1851
full_state = False ,
1852
1852
since_token = since_token ,
1853
1853
upto_token = leave_token ,
1854
+ out_of_band = leave_event .internal_metadata .is_out_of_band_membership (),
1854
1855
)
1855
1856
)
1856
1857
@@ -2117,33 +2118,41 @@ async def _generate_room_entry(
2117
2118
):
2118
2119
return
2119
2120
2120
- state = await self .compute_state_delta (
2121
- room_id ,
2122
- batch ,
2123
- sync_config ,
2124
- since_token ,
2125
- now_token ,
2126
- full_state = full_state ,
2127
- )
2121
+ if not room_builder .out_of_band :
2122
+ state = await self .compute_state_delta (
2123
+ room_id ,
2124
+ batch ,
2125
+ sync_config ,
2126
+ since_token ,
2127
+ now_token ,
2128
+ full_state = full_state ,
2129
+ )
2130
+ else :
2131
+ # An out of band room won't have any state changes.
2132
+ state = {}
2128
2133
2129
2134
summary : Optional [JsonDict ] = {}
2130
2135
2131
2136
# we include a summary in room responses when we're lazy loading
2132
2137
# members (as the client otherwise doesn't have enough info to form
2133
2138
# the name itself).
2134
- if sync_config .filter_collection .lazy_load_members () and (
2135
- # we recalculate the summary:
2136
- # if there are membership changes in the timeline, or
2137
- # if membership has changed during a gappy sync, or
2138
- # if this is an initial sync.
2139
- any (ev .type == EventTypes .Member for ev in batch .events )
2140
- or (
2141
- # XXX: this may include false positives in the form of LL
2142
- # members which have snuck into state
2143
- batch .limited
2144
- and any (t == EventTypes .Member for (t , k ) in state )
2139
+ if (
2140
+ not room_builder .out_of_band
2141
+ and sync_config .filter_collection .lazy_load_members ()
2142
+ and (
2143
+ # we recalculate the summary:
2144
+ # if there are membership changes in the timeline, or
2145
+ # if membership has changed during a gappy sync, or
2146
+ # if this is an initial sync.
2147
+ any (ev .type == EventTypes .Member for ev in batch .events )
2148
+ or (
2149
+ # XXX: this may include false positives in the form of LL
2150
+ # members which have snuck into state
2151
+ batch .limited
2152
+ and any (t == EventTypes .Member for (t , k ) in state )
2153
+ )
2154
+ or since_token is None
2145
2155
)
2146
- or since_token is None
2147
2156
):
2148
2157
summary = await self .compute_summary (
2149
2158
room_id , sync_config , batch , state , now_token
@@ -2387,6 +2396,8 @@ class RoomSyncResultBuilder:
2387
2396
full_state: Whether the full state should be sent in result
2388
2397
since_token: Earliest point to return events from, or None
2389
2398
upto_token: Latest point to return events from.
2399
+ out_of_band: whether the events in the room are "out of band" events
2400
+ and the server isn't in the room.
2390
2401
"""
2391
2402
2392
2403
room_id : str
@@ -2396,3 +2407,5 @@ class RoomSyncResultBuilder:
2396
2407
full_state : bool
2397
2408
since_token : Optional [StreamToken ]
2398
2409
upto_token : StreamToken
2410
+
2411
+ out_of_band : bool = False
0 commit comments