diff --git a/apps/simplex-broadcast-bot/src/Broadcast/Options.hs b/apps/simplex-broadcast-bot/src/Broadcast/Options.hs index 932a6919d3..2d0b3f7dc9 100644 --- a/apps/simplex-broadcast-bot/src/Broadcast/Options.hs +++ b/apps/simplex-broadcast-bot/src/Broadcast/Options.hs @@ -76,7 +76,7 @@ mkChatOpts BroadcastBotOpts {coreOptions} = ChatOpts { coreOptions, deviceName = Nothing, - displayName = Nothing, + userDisplayName = Nothing, chatCmd = "", chatCmdDelay = 3, chatCmdLog = CCLNone, diff --git a/apps/simplex-directory-service/src/Directory/Options.hs b/apps/simplex-directory-service/src/Directory/Options.hs index 41e6402fcd..a2ab929777 100644 --- a/apps/simplex-directory-service/src/Directory/Options.hs +++ b/apps/simplex-directory-service/src/Directory/Options.hs @@ -85,7 +85,7 @@ mkChatOpts DirectoryOpts {coreOptions} = ChatOpts { coreOptions, deviceName = Nothing, - displayName = Nothing, + userDisplayName = Nothing, chatCmd = "", chatCmdDelay = 3, chatCmdLog = CCLNone, diff --git a/src/Simplex/Chat/Core.hs b/src/Simplex/Chat/Core.hs index 5e470d6c10..511fbf97b1 100644 --- a/src/Simplex/Chat/Core.hs +++ b/src/Simplex/Chat/Core.hs @@ -65,9 +65,9 @@ sendChatCmd :: ChatController -> ChatCommand -> IO ChatResponse sendChatCmd cc cmd = runReaderT (execChatCommand' cmd) cc getSelectActiveUser :: SQLiteStore -> ChatOpts -> IO (Maybe User) -getSelectActiveUser st ChatOpts {displayName} = do +getSelectActiveUser st ChatOpts {userDisplayName} = do users <- withTransaction st getUsers - case displayName of + case userDisplayName of Just name -> forM (find (\User {localDisplayName} -> localDisplayName == name) users) $ \u -> if activeUser u then pure u else withTransaction st (`setActiveUser` u) @@ -95,7 +95,7 @@ getSelectActiveUser st ChatOpts {displayName} = do in Just <$> withTransaction st (`setActiveUser` user) createActiveUser :: ChatController -> ChatOpts -> IO User -createActiveUser cc ChatOpts {displayName = name} = do +createActiveUser cc ChatOpts {userDisplayName = name} = do putStrLn "No user profiles found, it will be created now.\n\ \Please choose your display name.\n\ diff --git a/src/Simplex/Chat/Mobile.hs b/src/Simplex/Chat/Mobile.hs index 68fffa0f7b..a2129f3298 100644 --- a/src/Simplex/Chat/Mobile.hs +++ b/src/Simplex/Chat/Mobile.hs @@ -202,7 +202,7 @@ mobileChatOpts dbFilePrefix = yesToUpMigrations = False }, deviceName = Nothing, - displayName = Nothing, + userDisplayName = Nothing, chatCmd = "", chatCmdDelay = 3, chatCmdLog = CCLNone, diff --git a/src/Simplex/Chat/Options.hs b/src/Simplex/Chat/Options.hs index 90f04bf75a..91dc0953d5 100644 --- a/src/Simplex/Chat/Options.hs +++ b/src/Simplex/Chat/Options.hs @@ -40,7 +40,7 @@ import Simplex.Chat.Types (ContactName) data ChatOpts = ChatOpts { coreOptions :: CoreChatOpts, deviceName :: Maybe Text, - displayName :: Maybe ContactName, + userDisplayName :: Maybe ContactName, chatCmd :: String, chatCmdDelay :: Int, chatCmdLog :: ChatCmdLog, @@ -288,10 +288,10 @@ chatOptsP appDir defaultDbFileName = do <> metavar "DEVICE" <> help "Device name to use in connections with remote hosts and controller" ) - displayName <- + userDisplayName <- optional $ strOption - ( long "display-name" + ( long "user-display-name" <> metavar "DISPLAY_NAME" <> help "Create new or switch to existing user profile with this display name." ) @@ -384,7 +384,7 @@ chatOptsP appDir defaultDbFileName = do pure ChatOpts { coreOptions, - displayName, + userDisplayName, deviceName, chatCmd, chatCmdDelay, diff --git a/tests/ChatClient.hs b/tests/ChatClient.hs index b11a5903bf..cfd66eea0a 100644 --- a/tests/ChatClient.hs +++ b/tests/ChatClient.hs @@ -74,7 +74,7 @@ testOpts = ChatOpts { coreOptions = testCoreOpts, deviceName = Nothing, - displayName = Nothing, + userDisplayName = Nothing, chatCmd = "", chatCmdDelay = 3, chatCmdLog = CCLNone, diff --git a/tests/ChatTests/Profiles.hs b/tests/ChatTests/Profiles.hs index 6827061015..3ff8808541 100644 --- a/tests/ChatTests/Profiles.hs +++ b/tests/ChatTests/Profiles.hs @@ -224,9 +224,9 @@ testMultiWordProfileNames = alice #> "@'Cath J' hi" cath <# "'Alice Jones'> hi" where - aliceProfile' = (baseProfile :: Profile) {displayName = "Alice Jones"} - bobProfile' = (baseProfile :: Profile) {displayName = "Bob James"} - cathProfile' = (baseProfile :: Profile) {displayName = "Cath Johnson"} + aliceProfile' = baseProfile {displayName = "Alice Jones"} + bobProfile' = baseProfile {displayName = "Bob James"} + cathProfile' = baseProfile {displayName = "Cath Johnson"} baseProfile = Profile {displayName = "", fullName = "", image = Nothing, contactLink = Nothing, preferences = defaultPrefs} testUserContactLink :: HasCallStack => FilePath -> IO ()