Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Autocreate autojoin rooms #3975

Merged
merged 16 commits into from
Oct 25, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion changelog.d/3975.feature
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Servers with auto-join rooms, should automatically create those rooms when first user registers
Servers with auto-join rooms, will now automatically create those rooms when the first user registers
neilisfragile marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion synapse/config/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from synapse.types import RoomAlias
from synapse.util.stringutils import random_string_with_symbols

from ._base import Config, ConfigError
from synapse.config._base import Config, ConfigError


class RegistrationConfig(Config):
Expand Down
10 changes: 5 additions & 5 deletions synapse/handlers/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,15 @@ def register(
for r in self.hs.config.auto_join_rooms:
try:
if should_auto_create_rooms:
if self.hs.hostname != RoomAlias.from_string(r).domain:
logger.warn(
room_alias = RoomAlias.from_string(r)
if self.hs.hostname != room_alias.domain:
logger.warning(
'Cannot create room alias %s, '
'it does not match server domain' % (r,)
'it does not match server domain', (r,)
neilisfragile marked this conversation as resolved.
Show resolved Hide resolved
)
raise SynapseError()
else:
# create room expects the localpart of the room alias
room_alias_localpart = RoomAlias.from_string(r).localpart
room_alias_localpart = room_alias.localpart
yield self.room_creation_handler.create_room(
fake_requester,
config={
Expand Down