summary refs log tree commit diff
path: root/synapse/config
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-02-14 18:16:32 +0000
committerErik Johnston <erik@matrix.org>2019-02-14 18:16:32 +0000
commitcb12a377082f2241ee8a8280810e9e38fb69778d (patch)
tree4382ffda174e3eee6d0724396499b20ab68bc499 /synapse/config
parentOnly fetch aliases when publishing rooms (diff)
downloadsynapse-cb12a377082f2241ee8a8280810e9e38fb69778d.tar.xz
Clarify and fix behaviour when there are multiple aliases
Diffstat (limited to 'synapse/config')
-rw-r--r--synapse/config/room_directory.py24
1 files changed, 18 insertions, 6 deletions
diff --git a/synapse/config/room_directory.py b/synapse/config/room_directory.py
index 719892be7a..af84adf5fa 100644
--- a/synapse/config/room_directory.py
+++ b/synapse/config/room_directory.py
@@ -58,7 +58,11 @@ class RoomDirectoryConfig(Config):
         # which rooms can be published in the public room list.
         #
         # The format of this option is the same as that for
-        # `alias_creation_rules`
+        # `alias_creation_rules`.
+        #
+        # If the room has one or more aliases associated with it, the rules are
+        # run against each alias. If there are no aliases then only rules with
+        # `alias: *` match.
         room_list_publication_rules:
             - user_id: "*"    # Matches against the user publishing the room
               alias: "*"      # Matches against any current local or canonical
@@ -156,11 +160,19 @@ class _RoomDirectoryRule(object):
 
         # If we are not given any aliases then this rule only matches if the
         # alias glob matches all aliases
-        if not aliases and not self._alias_matches_all:
-            return False
-
-        for alias in aliases:
-            if not self._alias_regex.match(alias):
+        matched = False
+        if not aliases:
+            if not self._alias_matches_all:
+                return False
+        else:
+            # Otherwise, we just need one alias to match
+            matched = False
+            for alias in aliases:
+                if self._alias_regex.match(alias):
+                    matched = True
+                    break
+
+            if not matched:
                 return False
 
         if not self._room_id_regex.match(room_id):