Fix FrozenEventBase
This commit is contained in:
@@ -189,6 +189,8 @@ 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
|
||||
@@ -265,16 +267,6 @@ class FrozenEventBase(EventBase):
|
||||
def event_id(self) -> str:
|
||||
raise NotImplementedError()
|
||||
|
||||
@property
|
||||
def type(self) -> str:
|
||||
raise NotImplementedError()
|
||||
|
||||
@property
|
||||
def state_key(self) -> str:
|
||||
"""Raises if there is no state key.
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
class FrozenEvent(FrozenEventBase):
|
||||
format_version = EventFormatVersions.V1 # All events of this type are V1
|
||||
@@ -300,10 +292,7 @@ class FrozenEvent(FrozenEventBase):
|
||||
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,
|
||||
@@ -313,6 +302,10 @@ class FrozenEvent(FrozenEventBase):
|
||||
rejected_reason=rejected_reason,
|
||||
)
|
||||
|
||||
@property
|
||||
def event_id(self) -> str:
|
||||
return self._event_id
|
||||
|
||||
def __str__(self):
|
||||
return self.__repr__()
|
||||
|
||||
@@ -351,9 +344,6 @@ class FrozenEventV2(FrozenEventBase):
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user