core: multiple users view, tests (#1710)

This commit is contained in:
JRoberts
2023-01-11 11:00:28 +04:00
committed by GitHub
parent ad1b091b18
commit 41e873d5ca
4 changed files with 263 additions and 107 deletions
+1
View File
@@ -423,6 +423,7 @@ createUser :: DB.Connection -> Profile -> Bool -> ExceptT StoreError IO User
createUser db Profile {displayName, fullName, image, preferences = userPreferences} activeUser =
checkConstraint SEDuplicateName . liftIO $ do
currentTs <- getCurrentTime
when activeUser $ DB.execute_ db "UPDATE users SET active_user = 0"
DB.execute
db
"INSERT INTO users (local_display_name, active_user, contact_id, created_at, updated_at) VALUES (?,?,0,?,?)"