summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2016-07-08 15:15:55 +0100
committerMark Haines <mark.haines@matrix.org>2016-07-08 15:15:55 +0100
commit10c843fcfbd6c3f6bcc13c5b9c71c9007ee54480 (patch)
treeda1db887330329247bfcd375cdc781660234201e
parentMerge branch 'master' of github.com:matrix-org/synapse into develop (diff)
downloadsynapse-10c843fcfbd6c3f6bcc13c5b9c71c9007ee54480.tar.xz
Ensure that the guest user is in the database when upgrading accounts
Diffstat (limited to '')
-rw-r--r--synapse/storage/registration.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/synapse/storage/registration.py b/synapse/storage/registration.py
index 0a68341494..3a675e53f6 100644
--- a/synapse/storage/registration.py
+++ b/synapse/storage/registration.py
@@ -127,11 +127,24 @@ class RegistrationStore(SQLBaseStore):
 
         try:
             if was_guest:
+                # Ensure that the guest user actually exists
+                self._simple_select_one_txn(
+                    txn,
+                    "users",
+                    keyvalues={
+                        "name": user_id,
+                        "is_guest": 1,
+                    },
+                    retcols=("name",),
+                    allow_none=False,
+                )
+
                 self._simple_update_one_txn(
                     txn,
                     "users",
                     keyvalues={
                         "name": user_id,
+                        "is_guest": 1,
                     },
                     updatevalues={
                         "password_hash": password_hash,