mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2025-03-14 09:45:42 +00:00
core: remove unused events from api (#3764)
* core: remove unused events from api * fix test
This commit is contained in:
parent
f2d498dd79
commit
a1328c287c
2 changed files with 10 additions and 3 deletions
|
@ -271,9 +271,18 @@ chatSendRemoteCmd :: ChatController -> Maybe RemoteHostId -> B.ByteString -> IO
|
|||
chatSendRemoteCmd cc rh s = J.encode . APIResponse Nothing rh <$> runReaderT (execChatCommand rh s) cc
|
||||
|
||||
chatRecvMsg :: ChatController -> IO JSONByteString
|
||||
chatRecvMsg ChatController {outputQ} = json <$> atomically (readTBQueue outputQ)
|
||||
chatRecvMsg ChatController {outputQ} = json <$> readChatResponse
|
||||
where
|
||||
json (corr, remoteHostId, resp) = J.encode APIResponse {corr, remoteHostId, resp}
|
||||
readChatResponse = do
|
||||
out@(_, _, cr) <- atomically $ readTBQueue outputQ
|
||||
if filterEvent cr then pure out else readChatResponse
|
||||
filterEvent = \case
|
||||
CRGroupSubscribed {} -> False
|
||||
CRGroupEmpty {} -> False
|
||||
CRMemberSubSummary {} -> False
|
||||
CRPendingSubSummary {} -> False
|
||||
_ -> True
|
||||
|
||||
chatRecvMsgWait :: ChatController -> Int -> IO JSONByteString
|
||||
chatRecvMsgWait cc time = fromMaybe "" <$> timeout time (chatRecvMsg cc)
|
||||
|
|
|
@ -224,8 +224,6 @@ testChatApi tmp = do
|
|||
chatSendCmd cc "/_start" `shouldReturn` chatStarted
|
||||
chatRecvMsg cc `shouldReturn` networkStatuses
|
||||
chatRecvMsg cc `shouldReturn` userContactSubSummary
|
||||
chatRecvMsg cc `shouldReturn` memberSubSummary
|
||||
chatRecvMsgWait cc 10000 `shouldReturn` pendingSubSummary
|
||||
chatRecvMsgWait cc 10000 `shouldReturn` ""
|
||||
chatParseMarkdown "hello" `shouldBe` "{}"
|
||||
chatParseMarkdown "*hello*" `shouldBe` parsedMarkdown
|
||||
|
|
Loading…
Add table
Reference in a new issue