summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2015-01-07 16:09:00 +0000
committerKegan Dougal <kegan@matrix.org>2015-01-07 16:09:00 +0000
commit4c68460392ef032b156b8d006f4aec5496ceedcb (patch)
tree29e51118deba86377b44aa0b3220b2cb2568670b /synapse/handlers
parentSYN-154: Better error messages when joining an unknown room by ID. (diff)
downloadsynapse-4c68460392ef032b156b8d006f4aec5496ceedcb.tar.xz
SYN-154: Tweak how the m.room.create check is done.
Don't perform the check in auth.is_host_in_room but instead do it in _do_join
and also assert that there are no m.room.members in the room before doing so.
Diffstat (limited to '')
-rw-r--r--synapse/handlers/room.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index 3cb7e324fc..16c6628292 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -423,9 +423,18 @@ class RoomMemberHandler(BaseHandler):
 
         is_host_in_room = yield self.auth.check_host_in_room(
             event.room_id,
-            self.hs.hostname,
-            context=context
+            self.hs.hostname
         )
+        if not is_host_in_room:
+            # is *anyone* in the room?
+            room_member_keys = [
+                v for (k,v) in context.current_state.keys() if k == "m.room.member"
+            ]
+            if len(room_member_keys) == 0:
+                # has the room been created so we can join it?
+                create_event = context.current_state.get(("m.room.create", ""))
+                if create_event:
+                    is_host_in_room = True
 
         if is_host_in_room:
             should_do_dance = False