Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
cb12a377
Commit
cb12a377
authored
6 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Clarify and fix behaviour when there are multiple aliases
parent
f61b2068
No related branches found
Branches containing commit
No related tags found
Tags containing commit
Loading
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
synapse/config/room_directory.py
+18
-6
18 additions, 6 deletions
synapse/config/room_directory.py
tests/config/test_room_directory.py
+6
-0
6 additions, 0 deletions
tests/config/test_room_directory.py
with
24 additions
and
6 deletions
synapse/config/room_directory.py
+
18
−
6
View file @
cb12a377
...
...
@@ -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
):
...
...
This diff is collapsed.
Click to expand it.
tests/config/test_room_directory.py
+
6
−
0
View file @
cb12a377
...
...
@@ -138,3 +138,9 @@ class RoomDirectoryConfigTestCase(unittest.TestCase):
room_id
=
"
!test-deny
"
,
aliases
=
[],
))
self
.
assertTrue
(
rd_config
.
is_publishing_room_allowed
(
user_id
=
"
@test:example.com
"
,
room_id
=
"
!test
"
,
aliases
=
[
"
#unofficial_st:example.com
"
,
"
#blah:example.com
"
],
))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment