This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Mark all MSC2716 events as historical #10537
Merged
MadLittleMods
merged 2 commits into
develop
from
madlittlemods/make-all-msc2716-events-historical
Aug 6, 2021
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Mark all events stemming from the MSC2716 `/batch_send` endpoint as historical. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -458,6 +458,9 @@ async def on_POST(self, request, room_id): | |
"state_key": state_event["state_key"], | ||
} | ||
|
||
# Mark all events as historical | ||
event_dict["content"][EventContentFields.MSC2716_HISTORICAL] = True | ||
|
||
# Make the state events float off on their own | ||
fake_prev_event_id = "$" + random_string(43) | ||
|
||
|
@@ -562,7 +565,10 @@ async def on_POST(self, request, room_id): | |
"type": EventTypes.MSC2716_CHUNK, | ||
"sender": requester.user.to_string(), | ||
"room_id": room_id, | ||
"content": {EventContentFields.MSC2716_CHUNK_ID: chunk_id_to_connect_to}, | ||
"content": { | ||
EventContentFields.MSC2716_CHUNK_ID: chunk_id_to_connect_to, | ||
EventContentFields.MSC2716_HISTORICAL: True, | ||
}, | ||
# Since the chunk event is put at the end of the chunk, | ||
# where the newest-in-time event is, copy the origin_server_ts from | ||
# the last event we're inserting | ||
|
@@ -589,10 +595,6 @@ async def on_POST(self, request, room_id): | |
for ev in events_to_create: | ||
assert_params_in_dict(ev, ["type", "origin_server_ts", "content", "sender"]) | ||
|
||
# Mark all events as historical | ||
# This has important semantics within the Synapse internals to backfill properly | ||
ev["content"][EventContentFields.MSC2716_HISTORICAL] = True | ||
|
||
event_dict = { | ||
"type": ev["type"], | ||
"origin_server_ts": ev["origin_server_ts"], | ||
|
@@ -602,6 +604,9 @@ async def on_POST(self, request, room_id): | |
"prev_events": prev_event_ids.copy(), | ||
} | ||
|
||
# Mark all events as historical | ||
event_dict["content"][EventContentFields.MSC2716_HISTORICAL] = True | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just moved this below to make it consistent with the way we modify the state events above. |
||
|
||
event, context = await self.event_creation_handler.create_event( | ||
await self._create_requester_for_user_id_from_app_service( | ||
ev["sender"], requester.app_service | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just the optional historical decoration field. But would be good to have all of the events include it.