most recent chat items in getDirectChatPreviews_ (#232)

This commit is contained in:
Efim Poberezkin
2022-01-28 19:24:31 +04:00
committed by GitHub
parent c3a8ae1eb5
commit 55dde3531e
2 changed files with 41 additions and 17 deletions

View File

@@ -34,8 +34,8 @@ serializeChatResponse = unlines . map unStyle . responseToView ""
responseToView :: String -> ChatResponse -> [StyledString]
responseToView cmd = \case
CRApiChats chats -> [sShow chats]
CRApiDirectChat chat -> [sShow chat]
CRApiChats chats -> api [sShow chats]
CRApiDirectChat chat -> api [sShow chat]
CRNewChatItem (AChatItem _ _ chat item) -> viewChatItem chat item
CRCmdAccepted _ -> r []
CRChatHelp section -> case section of
@@ -114,6 +114,7 @@ responseToView cmd = \case
CRMessageError prefix err -> [plain prefix <> ": " <> plain err]
CRChatError e -> viewChatError e
where
api = (highlight cmd :)
r = (plain cmd :)
-- this function should be `id` in case of asynchronous command responses
r' = r