mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-05-26 03:14:36 +00:00
simplify, make passed user active
This commit is contained in:
@@ -68,9 +68,9 @@ getSelectActiveUser :: SQLiteStore -> Maybe ContactName -> IO (Maybe User)
|
||||
getSelectActiveUser st displayName = do
|
||||
users <- withTransaction st getUsers
|
||||
case displayName of
|
||||
Just name -> case find (\User {localDisplayName} -> localDisplayName == name) users of
|
||||
Just u -> pure $ Just u
|
||||
Nothing -> pure Nothing
|
||||
Just name ->
|
||||
forM (find (\User {localDisplayName} -> localDisplayName == name) users) $ \u ->
|
||||
if activeUser u then pure u else withTransaction st (`setActiveUser` u)
|
||||
Nothing -> case find activeUser users of
|
||||
Just u -> pure $ Just u
|
||||
Nothing -> selectUser users
|
||||
|
||||
@@ -293,7 +293,7 @@ chatOptsP appDir defaultDbFileName = do
|
||||
strOption
|
||||
( long "display-name"
|
||||
<> metavar "DISPLAY_NAME"
|
||||
<> help "Display name will be sent to your contacts when you connect and only stored on your device and you can change it later."
|
||||
<> help "Create new or switch to existing user profile with this display name."
|
||||
)
|
||||
chatCmd <-
|
||||
strOption
|
||||
|
||||
Reference in New Issue
Block a user