core: simplify terminal mark messages read logic (#1589)

This commit is contained in:
JRoberts
2022-12-16 15:56:16 +04:00
committed by GitHub
parent 8786e2147a
commit cee403c1ed
7 changed files with 22 additions and 27 deletions
+3 -5
View File
@@ -84,7 +84,6 @@ responseToView user_ testView ts = \case
CRChatItemUpdated (AChatItem _ _ chat item) -> unmuted chat item $ viewItemUpdate chat item ts
CRChatItemDeleted (AChatItem _ _ chat deletedItem) toItem byUser timed -> unmuted chat deletedItem $ viewItemDelete chat deletedItem (isJust toItem) byUser timed ts
CRChatItemDeletedNotFound Contact {localDisplayName = c} _ -> [ttyFrom $ c <> "> [deleted - original message not found]"]
CRChatRead -> []
CRBroadcastSent mc n t -> viewSentBroadcast mc n ts t
CRMsgIntegrityError mErr -> viewMsgIntegrityError mErr
CRCmdAccepted _ -> []
@@ -252,10 +251,9 @@ responseToView user_ testView ts = \case
contactList :: [ContactRef] -> String
contactList cs = T.unpack . T.intercalate ", " $ map (\ContactRef {localDisplayName = n} -> "@" <> n) cs
unmuted :: ChatInfo c -> ChatItem c d -> [StyledString] -> [StyledString]
unmuted chat chatItem s =
if muted chat chatItem
then []
else s
unmuted chat chatItem s
| muted chat chatItem = []
| otherwise = s
muted :: ChatInfo c -> ChatItem c d -> Bool
muted chat ChatItem {chatDir} = case (chat, chatDir) of