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

Commit 225be77

Browse files
authored
Rebuild event auth when rebuilding an event after a call to a ThirdPartyEventRules module (#10316)
Because modules might send extra state events when processing an event (e.g. matrix-org/synapse-dinsic#100), and in some cases these extra events might get dropped if we don't recalculate the initial event's auth.
1 parent 189652b commit 225be77

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

changelog.d/10316.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Rebuild event context and auth when processing specific results from `ThirdPartyEventRules` modules.

synapse/handlers/message.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,11 +1594,13 @@ async def _rebuild_event_after_third_party_rules(
15941594
for k, v in original_event.internal_metadata.get_dict().items():
15951595
setattr(builder.internal_metadata, k, v)
15961596

1597-
# the event type hasn't changed, so there's no point in re-calculating the
1598-
# auth events.
1597+
# modules can send new state events, so we re-calculate the auth events just in
1598+
# case.
1599+
prev_event_ids = await self.store.get_prev_events_for_room(builder.room_id)
1600+
15991601
event = await builder.build(
1600-
prev_event_ids=original_event.prev_event_ids(),
1601-
auth_event_ids=original_event.auth_event_ids(),
1602+
prev_event_ids=prev_event_ids,
1603+
auth_event_ids=None,
16021604
)
16031605

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

0 commit comments

Comments
 (0)