summary refs log tree commit diff
path: root/synapse/storage/data_stores/main/registration.py
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-03-24 13:29:30 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2020-03-24 13:29:30 +0000
commit4c75c20fc56936d5c5ac69c45aa3de3256a506b8 (patch)
treedfc324a12e89dca037818eadec1f589176b7deb7 /synapse/storage/data_stores/main/registration.py
parentDon't refuse to start worker if media listener configured. (#7002) (diff)
parentFixed set a user as an admin with the new API (#6928) (diff)
downloadsynapse-4c75c20fc56936d5c5ac69c45aa3de3256a506b8.tar.xz
Fixed set a user as an admin with the new API (#6928)
* commit '9b06d8f8a':
  Fixed set a user as an admin with the new API (#6928)
Diffstat (limited to 'synapse/storage/data_stores/main/registration.py')
-rw-r--r--synapse/storage/data_stores/main/registration.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/synapse/storage/data_stores/main/registration.py b/synapse/storage/data_stores/main/registration.py

index 40f891cc64..035fe348b0 100644 --- a/synapse/storage/data_stores/main/registration.py +++ b/synapse/storage/data_stores/main/registration.py
@@ -323,12 +323,16 @@ class RegistrationWorkerStore(SQLBaseStore): admin (bool): true iff the user is to be a server admin, false otherwise. """ - return self.db.simple_update_one( - table="users", - keyvalues={"name": user.to_string()}, - updatevalues={"admin": 1 if admin else 0}, - desc="set_server_admin", - ) + + def set_server_admin_txn(txn): + self.db.simple_update_one_txn( + txn, "users", {"name": user.to_string()}, {"admin": 1 if admin else 0} + ) + self._invalidate_cache_and_stream( + txn, self.get_user_by_id, (user.to_string(),) + ) + + return self.db.runInteraction("set_server_admin", set_server_admin_txn) def _query_for_auth(self, txn, token): sql = (