From 60dee29d76db47784b5d369a1b5c1108e45c06b3 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Thu, 11 May 2023 11:37:02 +0100 Subject: [PATCH] refactor --- src/Simplex/Chat.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Simplex/Chat.hs b/src/Simplex/Chat.hs index 7d2913353..ffd84d02b 100644 --- a/src/Simplex/Chat.hs +++ b/src/Simplex/Chat.hs @@ -654,7 +654,8 @@ processChatCommand = \case case (ciContent, itemSharedMsgId) of (CISndMsgContent oldMC, Just itemSharedMId) -> do let changed = mc /= oldMC - if changed || fromMaybe False itemLive + updated = changed || fromMaybe False itemLive + ci' <- if updated then do (SndMessage {msgId}, _) <- sendDirectContactMessage ct (XMsgUpdate itemSharedMId mc (ttl' <$> itemTimed) (justTrue . (live &&) =<< itemLive)) ci' <- withStore' $ \db -> do @@ -664,8 +665,9 @@ processChatCommand = \case updateDirectChatItem' db user contactId ci (CISndMsgContent mc) live $ Just msgId startUpdatedTimedItemThread user (ChatRef CTDirect contactId) ci ci' setActive $ ActiveC c - pure $ CRChatItemUpdated user (AChatItem SCTDirect SMDSnd (DirectChat ct) ci') True - else pure $ CRChatItemUpdated user (AChatItem SCTDirect SMDSnd (DirectChat ct) ci) False + pure ci' + else pure ci + pure $ CRChatItemUpdated user (AChatItem SCTDirect SMDSnd (DirectChat ct) ci') updated _ -> throwChatError CEInvalidChatItemUpdate CChatItem SMDRcv _ -> throwChatError CEInvalidChatItemUpdate CTGroup -> do