summary refs log tree commit diff
path: root/synapse/storage/registration.py
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2017-11-01 15:51:25 +0000
committerMatthew Hodgson <matthew@matrix.org>2017-11-01 15:51:30 +0000
commit9f7a555b4e8c1d90a638365cf1d4acb3ce7f3db7 (patch)
tree6873a112a7a90c163a6687fcb3728a4b7e2342f8 /synapse/storage/registration.py
parentautomatically set default displayname on register (diff)
downloadsynapse-9f7a555b4e8c1d90a638365cf1d4acb3ce7f3db7.tar.xz
switch to setting default displayname in the storage layer
to avoid clobbering guest user displaynames on registration
Diffstat (limited to 'synapse/storage/registration.py')
-rw-r--r--synapse/storage/registration.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/synapse/storage/registration.py b/synapse/storage/registration.py
index 20acd58fcf..3442af4b90 100644
--- a/synapse/storage/registration.py
+++ b/synapse/storage/registration.py
@@ -177,9 +177,11 @@ class RegistrationStore(background_updates.BackgroundUpdateStore):
             )
 
         if create_profile_with_localpart:
+            # set a default displayname serverside to avoid ugly race
+            # between auto-joins and clients trying to set displaynames
             txn.execute(
-                "INSERT INTO profiles(user_id) VALUES (?)",
-                (create_profile_with_localpart,)
+                "INSERT INTO profiles(user_id, displayname) VALUES (?,?)",
+                (create_profile_with_localpart, create_profile_with_localpart)
             )
 
         self._invalidate_cache_and_stream(