core: check item status is not already SndRcvd before updating to SndSent (#2708)

This commit is contained in:
spaced4ndy authored and GitHub committed 2023-07-17 15:25:32 +04:00
1 parent d3b5bbe566
commit 938bd56c3a
2 files changed
+2 -1

No files matched your search

+1
View File
@@ -2870,6 +2870,7 @@ processAgentMessageConn user@User {userId} corrId agentConnId agentMessage = do
sentMsgDeliveryEvent conn msgId
checkSndInlineFTComplete conn msgId
withStore' (\db -> getDirectChatItemByAgentMsgId db user contactId connId msgId) >>= \case
Just (CChatItem SMDSnd ChatItem {meta = CIMeta {itemStatus = CISSndRcvd _}}) -> pure ()
Just (CChatItem SMDSnd ci) -> do
chatItem <- withStore $ \db -> updateDirectChatItemStatus db user contactId (chatItemId' ci) CISSndSent
toView $ CRChatItemStatusUpdated user (AChatItem SCTDirect SMDSnd (DirectChat ct) chatItem)
+1 -1
View File
@@ -843,7 +843,7 @@ msgDeliveryStatusT = eitherToMaybe . parseAll statusP . encodeUtf8
"snd_rcvd" -> AMDS SMDSnd . MDSSndRcvd <$> (A.space *> strP)
"snd_read" -> pure $ AMDS SMDSnd MDSSndRead
_ -> fail "bad AMsgDeliveryStatus"
msgDeliveryStatusT' :: forall d. MsgDirectionI d => Text -> Maybe (MsgDeliveryStatus d)
msgDeliveryStatusT' s =
msgDeliveryStatusT s >>= \(AMDS d st) ->