diff --git a/src/Simplex/Chat.hs b/src/Simplex/Chat.hs index 66fac0bdda..ba228f7d15 100644 --- a/src/Simplex/Chat.hs +++ b/src/Simplex/Chat.hs @@ -436,7 +436,7 @@ processChatCommand = \case let p = (profile :: Profile) {displayName = displayName, fullName = fullName} updateProfile user p UpdateProfileImage image -> withUser $ \user@User {profile} -> do - let p = (profile :: Profile) {image = Just image} + let p = (profile :: Profile) {image} updateProfile user p QuitChat -> liftIO exitSuccess ShowVersion -> pure $ CRVersionInfo versionNumber @@ -1559,7 +1559,8 @@ chatCommandP = <|> ("/reject @" <|> "/reject " <|> "/rc @" <|> "/rc ") *> (RejectContact <$> displayName) <|> ("/markdown" <|> "/m") $> ChatHelp HSMarkdown <|> ("/welcome" <|> "/w") $> Welcome - <|> "/profile_image " *> (UpdateProfileImage . ProfileImage <$> imageP) + <|> "/profile_image " *> (UpdateProfileImage . Just . ProfileImage <$> imageP) + <|> "/profile_image" $> UpdateProfileImage Nothing <|> ("/profile " <|> "/p ") *> (uncurry UpdateProfile <$> userNames) <|> ("/profile" <|> "/p") $> ShowProfile <|> ("/quit" <|> "/q" <|> "/exit") $> QuitChat diff --git a/src/Simplex/Chat/Controller.hs b/src/Simplex/Chat/Controller.hs index bb61324e2a..69bc95e44e 100644 --- a/src/Simplex/Chat/Controller.hs +++ b/src/Simplex/Chat/Controller.hs @@ -131,7 +131,7 @@ data ChatCommand | FileStatus FileTransferId | ShowProfile | UpdateProfile ContactName Text - | UpdateProfileImage ProfileImage + | UpdateProfileImage (Maybe ProfileImage) | QuitChat | ShowVersion deriving (Show) diff --git a/tests/ChatTests.hs b/tests/ChatTests.hs index 889bb8ec06..a3606b859e 100644 --- a/tests/ChatTests.hs +++ b/tests/ChatTests.hs @@ -670,6 +670,8 @@ testUpdateProfileImage = -- Note we currently don't support removing profile image. alice ##> "/profile_image data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII=" alice <## "profile image updated" + alice ##> "/profile_image" + alice <## "profile image removed" (bob