Fix rejecting invites over federation (#12409)
Currently causes future incremental syncs to fail. Broke by #12191pull/12412/head
parent
36af768c13
commit
7732c4902c
|
@ -0,0 +1 @@
|
||||||
|
Avoid trying to calculate the state at outlier events.
|
|
@ -1851,6 +1851,7 @@ class SyncHandler:
|
||||||
full_state=False,
|
full_state=False,
|
||||||
since_token=since_token,
|
since_token=since_token,
|
||||||
upto_token=leave_token,
|
upto_token=leave_token,
|
||||||
|
out_of_band=leave_event.internal_metadata.is_out_of_band_membership(),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -2117,33 +2118,41 @@ class SyncHandler:
|
||||||
):
|
):
|
||||||
return
|
return
|
||||||
|
|
||||||
state = await self.compute_state_delta(
|
if not room_builder.out_of_band:
|
||||||
room_id,
|
state = await self.compute_state_delta(
|
||||||
batch,
|
room_id,
|
||||||
sync_config,
|
batch,
|
||||||
since_token,
|
sync_config,
|
||||||
now_token,
|
since_token,
|
||||||
full_state=full_state,
|
now_token,
|
||||||
)
|
full_state=full_state,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
# An out of band room won't have any state changes.
|
||||||
|
state = {}
|
||||||
|
|
||||||
summary: Optional[JsonDict] = {}
|
summary: Optional[JsonDict] = {}
|
||||||
|
|
||||||
# we include a summary in room responses when we're lazy loading
|
# we include a summary in room responses when we're lazy loading
|
||||||
# members (as the client otherwise doesn't have enough info to form
|
# members (as the client otherwise doesn't have enough info to form
|
||||||
# the name itself).
|
# the name itself).
|
||||||
if sync_config.filter_collection.lazy_load_members() and (
|
if (
|
||||||
# we recalculate the summary:
|
not room_builder.out_of_band
|
||||||
# if there are membership changes in the timeline, or
|
and sync_config.filter_collection.lazy_load_members()
|
||||||
# if membership has changed during a gappy sync, or
|
and (
|
||||||
# if this is an initial sync.
|
# we recalculate the summary:
|
||||||
any(ev.type == EventTypes.Member for ev in batch.events)
|
# if there are membership changes in the timeline, or
|
||||||
or (
|
# if membership has changed during a gappy sync, or
|
||||||
# XXX: this may include false positives in the form of LL
|
# if this is an initial sync.
|
||||||
# members which have snuck into state
|
any(ev.type == EventTypes.Member for ev in batch.events)
|
||||||
batch.limited
|
or (
|
||||||
and any(t == EventTypes.Member for (t, k) in state)
|
# XXX: this may include false positives in the form of LL
|
||||||
|
# members which have snuck into state
|
||||||
|
batch.limited
|
||||||
|
and any(t == EventTypes.Member for (t, k) in state)
|
||||||
|
)
|
||||||
|
or since_token is None
|
||||||
)
|
)
|
||||||
or since_token is None
|
|
||||||
):
|
):
|
||||||
summary = await self.compute_summary(
|
summary = await self.compute_summary(
|
||||||
room_id, sync_config, batch, state, now_token
|
room_id, sync_config, batch, state, now_token
|
||||||
|
@ -2387,6 +2396,8 @@ class RoomSyncResultBuilder:
|
||||||
full_state: Whether the full state should be sent in result
|
full_state: Whether the full state should be sent in result
|
||||||
since_token: Earliest point to return events from, or None
|
since_token: Earliest point to return events from, or None
|
||||||
upto_token: Latest point to return events from.
|
upto_token: Latest point to return events from.
|
||||||
|
out_of_band: whether the events in the room are "out of band" events
|
||||||
|
and the server isn't in the room.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
room_id: str
|
room_id: str
|
||||||
|
@ -2396,3 +2407,5 @@ class RoomSyncResultBuilder:
|
||||||
full_state: bool
|
full_state: bool
|
||||||
since_token: Optional[StreamToken]
|
since_token: Optional[StreamToken]
|
||||||
upto_token: StreamToken
|
upto_token: StreamToken
|
||||||
|
|
||||||
|
out_of_band: bool = False
|
||||||
|
|
Loading…
Reference in New Issue