diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2020-10-15 20:55:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-15 20:55:41 +0100 |
commit | 5649669c3ca770768c3e121aaf5189064c6a0acd (patch) | |
tree | ca387ad15fc170552017e8e18b49393a3266f7ea /synapse/events/__init__.py | |
parent | Solidify the HomeServer constructor. (#8515) (diff) | |
parent | changelog (diff) | |
download | synapse-5649669c3ca770768c3e121aaf5189064c6a0acd.tar.xz |
Merge pull request #8535 from matrix-org/rav/third_party_events_updates
Support modifying event content from ThirdPartyRules modules
Diffstat (limited to 'synapse/events/__init__.py')
-rw-r--r-- | synapse/events/__init__.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/synapse/events/__init__.py b/synapse/events/__init__.py index 7a51d0a22f..65df62107f 100644 --- a/synapse/events/__init__.py +++ b/synapse/events/__init__.py @@ -312,6 +312,12 @@ class EventBase(metaclass=abc.ABCMeta): """ return [e for e, _ in self.auth_events] + def freeze(self): + """'Freeze' the event dict, so it cannot be modified by accident""" + + # this will be a no-op if the event dict is already frozen. + self._dict = freeze(self._dict) + class FrozenEvent(EventBase): format_version = EventFormatVersions.V1 # All events of this type are V1 |