diff --git a/synapse/api/events/__init__.py b/synapse/api/events/__init__.py
index 0cee196851..910c990b33 100644
--- a/synapse/api/events/__init__.py
+++ b/synapse/api/events/__init__.py
@@ -22,7 +22,7 @@ def serialize_event(hs, e):
if not isinstance(e, SynapseEvent):
return e
- d = e.get_dict()
+ d = {k: v for k, v in e.get_dict().items() if v is not None or v is not False}
if "age_ts" in d:
d["age"] = int(hs.get_clock().time_msec()) - d["age_ts"]
del d["age_ts"]
@@ -58,17 +58,19 @@ class SynapseEvent(JsonEncodedObject):
"required_power_level",
"age_ts",
"prev_content",
+ "prev_state",
+ "pruned",
]
internal_keys = [
"is_state",
"prev_events",
- "prev_state",
"depth",
"destinations",
"origin",
"outlier",
"power_level",
+ "deleted",
]
required_keys = [
diff --git a/synapse/api/events/factory.py b/synapse/api/events/factory.py
index d3d96d73eb..c65ea8372b 100644
--- a/synapse/api/events/factory.py
+++ b/synapse/api/events/factory.py
@@ -17,7 +17,8 @@ from synapse.api.events.room import (
RoomTopicEvent, MessageEvent, RoomMemberEvent, FeedbackEvent,
InviteJoinEvent, RoomConfigEvent, RoomNameEvent, GenericEvent,
RoomPowerLevelsEvent, RoomJoinRulesEvent, RoomOpsPowerLevelsEvent,
- RoomCreateEvent, RoomAddStateLevelEvent, RoomSendEventLevelEvent
+ RoomCreateEvent, RoomAddStateLevelEvent, RoomSendEventLevelEvent,
+ RoomDeletionEvent,
)
from synapse.util.stringutils import random_string
@@ -39,6 +40,7 @@ class EventFactory(object):
RoomAddStateLevelEvent,
RoomSendEventLevelEvent,
RoomOpsPowerLevelsEvent,
+ RoomDeletionEvent,
]
def __init__(self, hs):
diff --git a/synapse/api/events/room.py b/synapse/api/events/room.py
index 3a4dbc58ce..9861395556 100644
--- a/synapse/api/events/room.py
+++ b/synapse/api/events/room.py
@@ -180,3 +180,12 @@ class RoomAliasesEvent(SynapseStateEvent):
def get_content_template(self):
return {}
+
+
+class RoomDeletionEvent(SynapseEvent):
+ TYPE = "m.room.deletion"
+
+ valid_keys = SynapseEvent.valid_keys + ["deletes"]
+
+ def get_content_template(self):
+ return {}
|