summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/presence.py18
-rw-r--r--synapse/handlers/room.py2
2 files changed, 16 insertions, 4 deletions
diff --git a/synapse/handlers/presence.py b/synapse/handlers/presence.py
index 7372a10f9b..9bfceda88a 100644
--- a/synapse/handlers/presence.py
+++ b/synapse/handlers/presence.py
@@ -650,15 +650,25 @@ class PresenceHandler(BaseHandler):
             room_ids = yield rm_handler.get_rooms_for_user(user)
 
             if not observers and not room_ids:
-                break
+                continue
 
             state = dict(push)
             del state["user_id"]
 
-            # Legacy handling
-            if "presence" not in state:
+            if "presence" in state:
+                # all is OK
+                pass
+            elif "state" in state:
+                # Legacy handling
                 state["presence"] = state["state"]
-            del state["state"]
+            else:
+                logger.warning("Received a presence 'push' EDU from %s without"
+                    + " either a 'presence' or 'state' key", origin
+                )
+                continue
+
+            if "state" in state:
+                del state["state"]
 
             if "last_active_ago" in state:
                 state["last_active"] = int(
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index b0c94d35af..34a19bc64e 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -134,6 +134,7 @@ class RoomCreationHandler(BaseRoomHandler):
                 etype=RoomNameEvent.TYPE,
                 room_id=room_id,
                 user_id=user_id,
+                required_power_level=5,
                 content={"name": name},
             )
 
@@ -145,6 +146,7 @@ class RoomCreationHandler(BaseRoomHandler):
                 etype=RoomTopicEvent.TYPE,
                 room_id=room_id,
                 user_id=user_id,
+                required_power_level=5,
                 content={"topic": topic},
             )