From 4724669bce9ebb91bbd8f2a3813fd099f9706640 Mon Sep 17 00:00:00 2001 From: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com> Date: Wed, 2 Feb 2022 23:50:43 +0400 Subject: [PATCH] prepare v1.1.0 (#259) --- package.yaml | 2 +- simplex-chat.cabal | 2 +- src/Simplex/Chat.hs | 3 +-- src/Simplex/Chat/Controller.hs | 2 +- src/Simplex/Chat/View.hs | 4 +++- tests/ChatClient.hs | 8 ++++++++ tests/ChatTests.hs | 8 +++----- 7 files changed, 18 insertions(+), 11 deletions(-) diff --git a/package.yaml b/package.yaml index 8aa1ae3f1..b8eb26a94 100644 --- a/package.yaml +++ b/package.yaml @@ -1,5 +1,5 @@ name: simplex-chat -version: 1.0.2 +version: 1.1.0 #synopsis: #description: homepage: https://github.com/simplex-chat/simplex-chat#readme diff --git a/simplex-chat.cabal b/simplex-chat.cabal index 041ee7391..504b01c19 100644 --- a/simplex-chat.cabal +++ b/simplex-chat.cabal @@ -5,7 +5,7 @@ cabal-version: 1.12 -- see: https://github.com/sol/hpack name: simplex-chat -version: 1.0.2 +version: 1.1.0 category: Web, System, Services, Cryptography homepage: https://github.com/simplex-chat/simplex-chat#readme author: simplex.chat diff --git a/src/Simplex/Chat.hs b/src/Simplex/Chat.hs index 8e993f1b7..8b8e867d0 100644 --- a/src/Simplex/Chat.hs +++ b/src/Simplex/Chat.hs @@ -365,8 +365,7 @@ processChatCommand user@User {userId, profile} = \case corrId <- liftIO $ SMP.CorrId <$> randomBytes gVar 8 void . forkIO $ withAgentLock a . withLock l $ - atomically . writeTBQueue q - =<< (Just corrId,) <$> (action `catchError` (pure . CRChatError)) + (atomically . writeTBQueue q) . (Just corrId,) =<< (action `catchError` (pure . CRChatError)) pure $ CRCmdAccepted corrId -- use function below to make commands "synchronous" -- procCmd :: m ChatResponse -> m ChatResponse diff --git a/src/Simplex/Chat/Controller.hs b/src/Simplex/Chat/Controller.hs index d1f3a65da..f3126037d 100644 --- a/src/Simplex/Chat/Controller.hs +++ b/src/Simplex/Chat/Controller.hs @@ -35,7 +35,7 @@ import System.IO (Handle) import UnliftIO.STM versionNumber :: String -versionNumber = "1.0.2" +versionNumber = "1.1.0" versionStr :: String versionStr = "SimpleX Chat v" <> versionNumber diff --git a/src/Simplex/Chat/View.hs b/src/Simplex/Chat/View.hs index 285b7295c..527ce3bac 100644 --- a/src/Simplex/Chat/View.hs +++ b/src/Simplex/Chat/View.hs @@ -117,7 +117,8 @@ responseToView cmd = \case where api = (highlight cmd :) r = (plain cmd :) - -- this function should be `r` for "synchronous" command responses + -- this function should be `r` for "synchronous", `id` for "asynchronous" command responses + -- r' = r r' = id viewChatItem :: ChatInfo c -> ChatItem c d -> [StyledString] @@ -482,6 +483,7 @@ viewChatError = \case SEDuplicateContactLink -> ["you already have chat address, to show: " <> highlight' "/sa"] SEUserContactLinkNotFound -> ["no chat address, to create: " <> highlight' "/ad"] SEContactRequestNotFoundByName c -> ["no contact request from " <> ttyContact c] + SEConnectionNotFound _ -> [] -- TODO mutes delete group error, but also mutes any error from getConnectionEntity e -> ["chat db error: " <> sShow e] ChatErrorAgent err -> case err of SMP SMP.AUTH -> ["error: this connection is deleted"] diff --git a/tests/ChatClient.hs b/tests/ChatClient.hs index 5a214e83a..a7bcf14d2 100644 --- a/tests/ChatClient.hs +++ b/tests/ChatClient.hs @@ -30,6 +30,7 @@ import System.Directory (createDirectoryIfMissing, removeDirectoryRecursive) import qualified System.Terminal as C import System.Terminal.Internal (VirtualTerminal (..), VirtualTerminalSettings (..), withVirtualTerminal) import System.Timeout (timeout) +import Test.Hspec (Expectation, shouldReturn) testDBPrefix :: FilePath testDBPrefix = "tests/tmp/test" @@ -116,10 +117,17 @@ testChatN ps test = let envs = zip ps $ map ((testDBPrefix <>) . show) [(1 :: Int) ..] tcs <- getTestCCs envs [] test tcs + concurrentlyN_ $ map ( virtualSimplexChat db p <*> getTestCCs envs' tcs +( Int -> Expectation +( IO String +getTermLine = atomically . readTQueue . termQ + testChat2 :: Profile -> Profile -> (TestCC -> TestCC -> IO ()) -> IO () testChat2 p1 p2 test = testChatN [p1, p2] test_ where diff --git a/tests/ChatTests.hs b/tests/ChatTests.hs index 5ee996bdb..71e1be0b5 100644 --- a/tests/ChatTests.hs +++ b/tests/ChatTests.hs @@ -15,7 +15,6 @@ import Simplex.Chat.Controller import Simplex.Chat.Types (Profile (..), User (..)) import Simplex.Chat.Util (unlessM) import System.Directory (doesFileExist) -import System.Timeout (timeout) import Test.Hspec aliceProfile :: Profile @@ -339,6 +338,8 @@ testGroupDelete = cath <## "#team: alice deleted the group" cath <## "use /d #team to delete the local copy of the group" ] + alice ##> "#team hi" + alice <## "no group #team" bob ##> "/d #team" bob <## "#team: you deleted the group" cath ##> "#team hi" @@ -840,7 +841,7 @@ cc <### ls = do cc <# line = (dropTime <$> getTermLine cc) `shouldReturn` line ( Expectation -( TestCC -> Expectation cc1 <#? cc2 = do @@ -857,9 +858,6 @@ dropTime msg = case splitAt 6 msg of if all isDigit [m, m', s, s'] then text else error "invalid time" _ -> error "invalid time" -getTermLine :: TestCC -> IO String -getTermLine = atomically . readTQueue . termQ - getInvitation :: TestCC -> IO String getInvitation cc = do cc <## "pass this invitation link to your contact (via another channel):"