1
0

Add proper state and state_groups so historical events return state from /context

See https://gitlab.com/gitterHQ/webapp/-/merge_requests/2229#note_683532091

Also seems to fix https://github.com/matrix-org/synapse/issues/10764
This commit is contained in:
Eric Eastwood
2021-09-29 18:51:08 -05:00
parent fa4f20dfb7
commit 4fea37ed06
2 changed files with 11 additions and 1 deletions
+9 -1
View File
@@ -959,7 +959,15 @@ class EventCreationHandler:
event.internal_metadata.outlier = True
context = EventContext.for_outlier()
else:
context = await self.state.compute_event_context(event)
old_state = None
# Define the state for historical messages while we know to get all of
# state_groups setup properly when we `compute_event_context`.
if builder.internal_metadata.is_historical() and auth_event_ids:
old_state = await self.store.get_events_as_list(auth_event_ids)
context = await self.state.compute_event_context(event, old_state=old_state)
logger.info("create_new_client_event type=%s, event_id=%s context=%s", event.type, event.event_id, context)
if requester:
context.app_service = requester.app_service
+2
View File
@@ -176,6 +176,8 @@ class RoomBatchSendEventRestServlet(RestServlet):
async def on_POST(
self, request: SynapseRequest, room_id: str
) -> Tuple[int, JsonDict]:
logger.info("room batch send =====================================================")
logger.info("=====================================================================")
requester = await self.auth.get_user_by_req(request, allow_guest=False)
if not requester.app_service: