Fix a bug with generating display names.

pull/8784/head
Patrick Cloke 2020-11-19 15:07:58 -05:00
parent 28ad9bf62e
commit 2e83da8ba6
1 changed files with 3 additions and 3 deletions

View File

@ -245,6 +245,8 @@ class RegistrationHandler(BaseHandler):
else:
# autogen a sequential user ID
fail_count = 0
# If a default display name is not given, generate one.
generate_display_name = default_display_name is None
# This breaks on successful registration *or* errors after 10 failures.
while True:
# Fail after being unable to find a suitable ID a few times
@ -255,9 +257,7 @@ class RegistrationHandler(BaseHandler):
user = UserID(localpart, self.hs.hostname)
user_id = user.to_string()
self.check_user_id_not_appservice_exclusive(user_id)
# TODO This looks incorrect since default_display_name can only
# ever be None for the first iteration.
if default_display_name is None:
if generate_display_name:
default_display_name = localpart
try:
await self.register_with_store(