core: notify about contact deletion only if contact is ready, catch errors (#3160)

This commit is contained in:
spaced4ndy 2023-10-02 16:29:13 +04:00 committed by GitHub
parent 8545a1e8f9
commit d4cbef1ba1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -897,7 +897,8 @@ processChatCommand = \case
filesInfo <- withStore' $ \db -> getContactFileInfo db user ct filesInfo <- withStore' $ \db -> getContactFileInfo db user ct
withChatLock "deleteChat direct" . procCmd $ do withChatLock "deleteChat direct" . procCmd $ do
deleteFilesAndConns user filesInfo deleteFilesAndConns user filesInfo
when (contactActive ct && notify) . void $ sendDirectContactMessage ct XDirectDel when (isReady ct && contactActive ct && notify) $
void (sendDirectContactMessage ct XDirectDel) `catchChatError` const (pure ())
contactConnIds <- map aConnId <$> withStore (\db -> getContactConnections db userId ct) contactConnIds <- map aConnId <$> withStore (\db -> getContactConnections db userId ct)
deleteAgentConnectionsAsync user contactConnIds deleteAgentConnectionsAsync user contactConnIds
-- functions below are called in separate transactions to prevent crashes on android -- functions below are called in separate transactions to prevent crashes on android