diff options
author | Brendan Abolivier <babolivier@matrix.org> | 2021-07-08 13:00:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-08 13:00:05 +0200 |
commit | 225be7778727682e250a02acf975217f8eca9ed7 (patch) | |
tree | bf448f4bbda1f4d808a46c05584b334329ebe0d3 /synapse/handlers/message.py | |
parent | Fix a broken link in the admin api docs (#10322) (diff) | |
download | synapse-225be7778727682e250a02acf975217f8eca9ed7.tar.xz |
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.
Diffstat (limited to '')
-rw-r--r-- | synapse/handlers/message.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py index 66e40a915d..b960e18c4c 100644 --- a/synapse/handlers/message.py +++ b/synapse/handlers/message.py @@ -1594,11 +1594,13 @@ class EventCreationHandler: 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, |