Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
1f32b90b
Unverified
Commit
1f32b90b
authored
2 years ago
by
Richard van der Hoff
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Room batch: fix up handling of unknown prev_event_ids (#12316)
parent
8a519f8a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changelog.d/12316.misc
+1
-0
1 addition, 0 deletions
changelog.d/12316.misc
synapse/rest/client/room_batch.py
+13
-8
13 additions, 8 deletions
synapse/rest/client/room_batch.py
with
14 additions
and
8 deletions
changelog.d/12316.misc
0 → 100644
+
1
−
0
View file @
1f32b90b
Avoid trying to calculate the state at outlier events.
This diff is collapsed.
Click to expand it.
synapse/rest/client/room_batch.py
+
13
−
8
View file @
1f32b90b
...
@@ -123,6 +123,19 @@ class RoomBatchSendEventRestServlet(RestServlet):
...
@@ -123,6 +123,19 @@ class RoomBatchSendEventRestServlet(RestServlet):
errcode
=
Codes
.
INVALID_PARAM
,
errcode
=
Codes
.
INVALID_PARAM
,
)
)
# Make sure that the prev_event_ids exist and aren't outliers - ie, they are
# regular parts of the room DAG where we know the state.
non_outlier_prev_events
=
await
self
.
store
.
have_events_in_timeline
(
prev_event_ids_from_query
)
for
prev_event_id
in
prev_event_ids_from_query
:
if
prev_event_id
not
in
non_outlier_prev_events
:
raise
SynapseError
(
HTTPStatus
.
BAD_REQUEST
,
"
prev_event %s does not exist, or is an outlier
"
%
(
prev_event_id
,),
errcode
=
Codes
.
INVALID_PARAM
,
)
# For the event we are inserting next to (`prev_event_ids_from_query`),
# For the event we are inserting next to (`prev_event_ids_from_query`),
# find the most recent state events that allowed that message to be
# find the most recent state events that allowed that message to be
# sent. We will use that as a base to auth our historical messages
# sent. We will use that as a base to auth our historical messages
...
@@ -131,14 +144,6 @@ class RoomBatchSendEventRestServlet(RestServlet):
...
@@ -131,14 +144,6 @@ class RoomBatchSendEventRestServlet(RestServlet):
prev_event_ids_from_query
prev_event_ids_from_query
)
)
if
not
state_event_ids
:
raise
SynapseError
(
HTTPStatus
.
BAD_REQUEST
,
"
No auth events found for given prev_event query parameter. The prev_event=%s probably does not exist.
"
%
prev_event_ids_from_query
,
errcode
=
Codes
.
INVALID_PARAM
,
)
state_event_ids_at_start
=
[]
state_event_ids_at_start
=
[]
# Create and persist all of the state events that float off on their own
# Create and persist all of the state events that float off on their own
# before the batch. These will most likely be all of the invite/member
# before the batch. These will most likely be all of the invite/member
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment