mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
4ecf51812e
I meant to do this before, in #10591, but because I'm stupid I forgot to do it for V2 and V3 events. I've factored the common code out to `EventBase` to save us having two copies of it. This means that for `FrozenEvent` we replace `self.get("event_id", None)` with `self.event_id`, which I think is safe. `get()` is an alias for `self._dict.get()`, whereas `event_id()` is an `@property` method which looks up `self._event_id`, which is populated during construction from the same dict. We don't seem to rely on the fallback, because if the `event_id` key is absent from the dict then construction of the `EventBase` object will fail. Long story short, the only way this could change behaviour is if `event_dict["event_id"]` is changed *after* the `EventBase` object is constructed without updating the `_event_id` field, or vice versa - either of which would be very problematic anyway and the behavior of `str(event)` is the least of our worries. |
||
---|---|---|
.. | ||
.gitignore | ||
10659.misc | ||
10776.feature | ||
10777.misc | ||
10785.misc | ||
10796.misc | ||
10807.bugfix | ||
10810.bugfix | ||
10812.misc | ||
10814.feature | ||
10815.misc | ||
10816.misc | ||
10817.misc | ||
10823.misc | ||
10829.misc | ||
10831.misc | ||
10834.misc | ||
10835.misc | ||
10838.misc | ||
10839.misc | ||
10843.bugfix | ||
10845.doc | ||
10856.misc | ||
10859.bugfix | ||
10867.misc | ||
10869.doc | ||
10879.misc |