Merge pull request #914 from matrix-org/markjh/upgrade
Ensure that the guest user is in the database when upgrading accounts
This commit is contained in:
commit
10f4856b0c
|
@ -127,11 +127,26 @@ class RegistrationStore(SQLBaseStore):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if was_guest:
|
if was_guest:
|
||||||
|
# Ensure that the guest user actually exists
|
||||||
|
# ``allow_none=False`` makes this raise an exception
|
||||||
|
# if the row isn't in the database.
|
||||||
|
self._simple_select_one_txn(
|
||||||
|
txn,
|
||||||
|
"users",
|
||||||
|
keyvalues={
|
||||||
|
"name": user_id,
|
||||||
|
"is_guest": 1,
|
||||||
|
},
|
||||||
|
retcols=("name",),
|
||||||
|
allow_none=False,
|
||||||
|
)
|
||||||
|
|
||||||
self._simple_update_one_txn(
|
self._simple_update_one_txn(
|
||||||
txn,
|
txn,
|
||||||
"users",
|
"users",
|
||||||
keyvalues={
|
keyvalues={
|
||||||
"name": user_id,
|
"name": user_id,
|
||||||
|
"is_guest": 1,
|
||||||
},
|
},
|
||||||
updatevalues={
|
updatevalues={
|
||||||
"password_hash": password_hash,
|
"password_hash": password_hash,
|
||||||
|
|
Loading…
Reference in New Issue