summary refs log tree commit diff
path: root/synapse/handlers/_base.py
diff options
context:
space:
mode:
authorDaniel Wagner-Hall <daniel@matrix.org>2015-08-28 15:35:39 +0100
committerDaniel Wagner-Hall <daniel@matrix.org>2015-08-28 15:35:39 +0100
commit4d1ea4000856cd29778da2616fb8f602892905e0 (patch)
tree68e4786675aa53586f31b27608f5acfe69a687af /synapse/handlers/_base.py
parentAllow users to redact their own events (diff)
parentMerge branch 'release-v0.10.0' into develop (diff)
downloadsynapse-4d1ea4000856cd29778da2616fb8f602892905e0.tar.xz
Merge branch 'develop' into redactyoself
Conflicts:
	synapse/handlers/_base.py
Diffstat (limited to 'synapse/handlers/_base.py')
-rw-r--r--synapse/handlers/_base.py32
1 files changed, 16 insertions, 16 deletions
diff --git a/synapse/handlers/_base.py b/synapse/handlers/_base.py
index 9d36e3b6d2..60ac6617ae 100644
--- a/synapse/handlers/_base.py
+++ b/synapse/handlers/_base.py
@@ -107,6 +107,22 @@ class BaseHandler(object):
         if not suppress_auth:
             self.auth.check(event, auth_events=context.current_state)
 
+        if event.type == EventTypes.CanonicalAlias:
+            # Check the alias is acually valid (at this time at least)
+            room_alias_str = event.content.get("alias", None)
+            if room_alias_str:
+                room_alias = RoomAlias.from_string(room_alias_str)
+                directory_handler = self.hs.get_handlers().directory_handler
+                mapping = yield directory_handler.get_association(room_alias)
+
+                if mapping["room_id"] != event.room_id:
+                    raise SynapseError(
+                        400,
+                        "Room alias %s does not point to the room" % (
+                            room_alias_str,
+                        )
+                    )
+
         (event_stream_id, max_stream_id) = yield self.store.persist_event(
             event, context=context
         )
@@ -130,22 +146,6 @@ class BaseHandler(object):
                         returned_invite.signatures
                     )
 
-        if event.type == EventTypes.CanonicalAlias:
-            # Check the alias is actually valid (at this time at least)
-            room_alias_str = event.content.get("alias", None)
-            if room_alias_str:
-                room_alias = RoomAlias.from_string(room_alias_str)
-                directory_handler = self.hs.get_handlers().directory_handler
-                mapping = yield directory_handler.get_association(room_alias)
-
-                if mapping["room_id"] != event.room_id:
-                    raise SynapseError(
-                        400,
-                        "Room alias %s does not point to the room" % (
-                            room_alias_str,
-                        )
-                    )
-
         if event.type == EventTypes.Redaction:
             if self.auth.check_redaction(event, auth_events=context.current_state):
                 original_event = yield self.store.get_event(