Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Rebuild event auth when rebuilding an event after a call to a ThirdPartyEventRules module #10316

Merged
merged 1 commit into from
Jul 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/10316.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Rebuild event context and auth when processing specific results from `ThirdPartyEventRules` modules.
babolivier marked this conversation as resolved.
Show resolved Hide resolved
10 changes: 6 additions & 4 deletions synapse/handlers/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -1594,11 +1594,13 @@ async def _rebuild_event_after_third_party_rules(
for k, v in original_event.internal_metadata.get_dict().items():
setattr(builder.internal_metadata, k, v)

# the event type hasn't changed, so there's no point in re-calculating the
# auth events.
# modules can send new state events, so we re-calculate the auth events just in
# case.
prev_event_ids = await self.store.get_prev_events_for_room(builder.room_id)

event = await builder.build(
prev_event_ids=original_event.prev_event_ids(),
auth_event_ids=original_event.auth_event_ids(),
prev_event_ids=prev_event_ids,
auth_event_ids=None,
)

# we rebuild the event context, to be on the safe side. If nothing else,
Expand Down