diff options
author | Richard van der Hoff <richard@matrix.org> | 2020-02-04 12:07:05 +0000 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2020-02-04 12:07:05 +0000 |
commit | 5ef91b96f1cadbdf981f4e67c2dc97d0bb290d6c (patch) | |
tree | 47c7979d13fe0f1f9dc86af39065830a0289fbcc /synapse/events/__init__.py | |
parent | make FederationClient.send_invite async (diff) | |
parent | Merge pull request #6837 from matrix-org/rav/federation_async (diff) | |
download | synapse-5ef91b96f1cadbdf981f4e67c2dc97d0bb290d6c.tar.xz |
Merge remote-tracking branch 'origin/develop' into rav/federation_client_async
Diffstat (limited to 'synapse/events/__init__.py')
-rw-r--r-- | synapse/events/__init__.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/synapse/events/__init__.py b/synapse/events/__init__.py index f813fa2fe7..92f76703b3 100644 --- a/synapse/events/__init__.py +++ b/synapse/events/__init__.py @@ -189,9 +189,15 @@ class EventBase(object): redacts = _event_dict_property("redacts", None) room_id = _event_dict_property("room_id") sender = _event_dict_property("sender") + state_key = _event_dict_property("state_key") + type = _event_dict_property("type") user_id = _event_dict_property("sender") @property + def event_id(self) -> str: + raise NotImplementedError() + + @property def membership(self): return self.content["membership"] @@ -281,10 +287,7 @@ class FrozenEvent(EventBase): else: frozen_dict = event_dict - self.event_id = event_dict["event_id"] - self.type = event_dict["type"] - if "state_key" in event_dict: - self.state_key = event_dict["state_key"] + self._event_id = event_dict["event_id"] super(FrozenEvent, self).__init__( frozen_dict, @@ -294,6 +297,10 @@ class FrozenEvent(EventBase): rejected_reason=rejected_reason, ) + @property + def event_id(self) -> str: + return self._event_id + def __str__(self): return self.__repr__() @@ -332,9 +339,6 @@ class FrozenEventV2(EventBase): frozen_dict = event_dict self._event_id = None - self.type = event_dict["type"] - if "state_key" in event_dict: - self.state_key = event_dict["state_key"] super(FrozenEventV2, self).__init__( frozen_dict, |