summary refs log tree commit diff
path: root/synapse/api/events
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-11-06 16:59:13 +0000
committerErik Johnston <erik@matrix.org>2014-11-06 16:59:13 +0000
commit351c64e99e5677096f9a2ae2cd7e84dbc1887878 (patch)
treebac8773d7d9b114bb48af789a942967d450c7bd1 /synapse/api/events
parentUpdate to use replaces_state rather than prev_state (diff)
downloadsynapse-351c64e99e5677096f9a2ae2cd7e84dbc1887878.tar.xz
Amalgamate all power levels.
Remove concept of reqired power levels, something similiar can be done
using the new power level event.
Diffstat (limited to 'synapse/api/events')
-rw-r--r--synapse/api/events/__init__.py3
-rw-r--r--synapse/api/events/factory.py7
-rw-r--r--synapse/api/events/room.py22
-rw-r--r--synapse/api/events/utils.py23
4 files changed, 14 insertions, 41 deletions
diff --git a/synapse/api/events/__init__.py b/synapse/api/events/__init__.py
index 98a66144e7..84d3a98365 100644
--- a/synapse/api/events/__init__.py
+++ b/synapse/api/events/__init__.py
@@ -56,12 +56,12 @@ class SynapseEvent(JsonEncodedObject):
         "user_id",  # sender/initiator
         "content",  # HTTP body, JSON
         "state_key",
-        "required_power_level",
         "age_ts",
         "prev_content",
         "replaces_state",
         "redacted_because",
         "origin_server_ts",
+        "auth_chains",
     ]
 
     internal_keys = [
@@ -70,7 +70,6 @@ class SynapseEvent(JsonEncodedObject):
         "destinations",
         "origin",
         "outlier",
-        "power_level",
         "redacted",
         "prev_events",
         "hashes",
diff --git a/synapse/api/events/factory.py b/synapse/api/events/factory.py
index 9134c82eff..a1ec708a81 100644
--- a/synapse/api/events/factory.py
+++ b/synapse/api/events/factory.py
@@ -16,8 +16,8 @@
 from synapse.api.events.room import (
     RoomTopicEvent, MessageEvent, RoomMemberEvent, FeedbackEvent,
     InviteJoinEvent, RoomConfigEvent, RoomNameEvent, GenericEvent,
-    RoomPowerLevelsEvent, RoomJoinRulesEvent, RoomOpsPowerLevelsEvent,
-    RoomCreateEvent, RoomAddStateLevelEvent, RoomSendEventLevelEvent,
+    RoomPowerLevelsEvent, RoomJoinRulesEvent,
+    RoomCreateEvent,
     RoomRedactionEvent,
 )
 
@@ -39,9 +39,6 @@ class EventFactory(object):
         RoomPowerLevelsEvent,
         RoomJoinRulesEvent,
         RoomCreateEvent,
-        RoomAddStateLevelEvent,
-        RoomSendEventLevelEvent,
-        RoomOpsPowerLevelsEvent,
         RoomRedactionEvent,
     ]
 
diff --git a/synapse/api/events/room.py b/synapse/api/events/room.py
index cd936074fc..25bc883706 100644
--- a/synapse/api/events/room.py
+++ b/synapse/api/events/room.py
@@ -153,28 +153,6 @@ class RoomPowerLevelsEvent(SynapseStateEvent):
     def get_content_template(self):
         return {}
 
-
-class RoomAddStateLevelEvent(SynapseStateEvent):
-    TYPE = "m.room.add_state_level"
-
-    def get_content_template(self):
-        return {}
-
-
-class RoomSendEventLevelEvent(SynapseStateEvent):
-    TYPE = "m.room.send_event_level"
-
-    def get_content_template(self):
-        return {}
-
-
-class RoomOpsPowerLevelsEvent(SynapseStateEvent):
-    TYPE = "m.room.ops_levels"
-
-    def get_content_template(self):
-        return {}
-
-
 class RoomAliasesEvent(SynapseStateEvent):
     TYPE = "m.room.aliases"
 
diff --git a/synapse/api/events/utils.py b/synapse/api/events/utils.py
index 31601fd3a9..5fc79105b5 100644
--- a/synapse/api/events/utils.py
+++ b/synapse/api/events/utils.py
@@ -15,7 +15,6 @@
 
 from .room import (
     RoomMemberEvent, RoomJoinRulesEvent, RoomPowerLevelsEvent,
-    RoomAddStateLevelEvent, RoomSendEventLevelEvent, RoomOpsPowerLevelsEvent,
     RoomAliasesEvent, RoomCreateEvent,
 )
 
@@ -52,17 +51,17 @@ def _prune_event_or_pdu(event_type, event):
     elif event_type == RoomJoinRulesEvent.TYPE:
         add_fields("join_rule")
     elif event_type == RoomPowerLevelsEvent.TYPE:
-        # TODO: Actually check these are valid user_ids etc.
-        add_fields("default")
-        for k, v in event.content.items():
-            if k.startswith("@") and isinstance(v, (int, long)):
-                new_content[k] = v
-    elif event_type == RoomAddStateLevelEvent.TYPE:
-        add_fields("level")
-    elif event_type == RoomSendEventLevelEvent.TYPE:
-        add_fields("level")
-    elif event_type == RoomOpsPowerLevelsEvent.TYPE:
-        add_fields("kick_level", "ban_level", "redact_level")
+        add_fields(
+            "users",
+            "users_default",
+            "events",
+            "events_default",
+            "events_default",
+            "state_default",
+            "ban",
+            "kick",
+            "redact",
+        )
     elif event_type == RoomAliasesEvent.TYPE:
         add_fields("aliases")