This commit is contained in:
spaced4ndy
2023-12-21 20:22:14 +04:00
parent f9f932cede
commit db3f1dab87
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -3605,7 +3605,7 @@ processAgentMessageConn user@User {userId} corrId agentConnId agentMessage = do
withStore' $ \db -> updateIntroStatus db introId GMIntroSent
sendHistory =
when (isCompatibleRange (memberChatVRange' m) batchSendVRange) $ do
(errs, items) <- withStore' $ \db -> getGroupHistoryLastItems db user gInfo 100
(errs, items) <- partitionEithers <$> withStore' (\db -> getGroupHistoryItems db user gInfo 100)
(errs', events) <- collectForwardEvents items [] []
let errors = map ChatErrorStore errs <> errs'
unless (null errors) $ toView $ CRChatErrors (Just user) errors
+4 -4
View File
@@ -99,7 +99,7 @@ module Simplex.Chat.Store.Messages
updateGroupSndStatus,
getGroupSndStatuses,
getGroupSndStatusCounts,
getGroupHistoryLastItems,
getGroupHistoryItems,
)
where
@@ -2080,11 +2080,11 @@ getGroupSndStatusCounts db itemId =
|]
(Only itemId)
getGroupHistoryLastItems :: DB.Connection -> User -> GroupInfo -> Int -> IO ([StoreError], [CChatItem 'CTGroup])
getGroupHistoryLastItems db user@User {userId} GroupInfo {groupId} count = do
getGroupHistoryItems :: DB.Connection -> User -> GroupInfo -> Int -> IO [Either StoreError (CChatItem 'CTGroup)]
getGroupHistoryItems db user@User {userId} GroupInfo {groupId} count = do
chatItemIds <- getLastItemIds_
-- use getGroupCIWithReactions to read reactions data
partitionEithers <$> mapM (runExceptT <$> getGroupChatItem db user groupId) chatItemIds
mapM (runExceptT . getGroupChatItem db user groupId) chatItemIds
where
getLastItemIds_ :: IO [ChatItemId]
getLastItemIds_ =