mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2025-03-14 09:45:42 +00:00
core: remove logs, remove log for A_DUPLICATE error (#896)
This commit is contained in:
parent
03d9d86aba
commit
7a00a3e324
3 changed files with 1 additions and 19 deletions
|
@ -440,27 +440,18 @@ processChatCommand = \case
|
|||
withStore' $ \db -> deletePendingContactConnection db userId chatId
|
||||
pure $ CRContactConnectionDeleted conn
|
||||
CTGroup -> do
|
||||
liftIO $ putStrLn "APIDeleteChat CTGroup"
|
||||
Group gInfo@GroupInfo {membership} members <- withStore $ \db -> getGroup db user chatId
|
||||
liftIO $ putStrLn "APIDeleteChat CTGroup: getGroup"
|
||||
let canDelete = memberRole (membership :: GroupMember) == GROwner || not (memberCurrent membership)
|
||||
unless canDelete $ throwChatError CEGroupUserRole
|
||||
liftIO $ putStrLn "APIDeleteChat CTGroup: canDelete"
|
||||
void $ clearGroupContent user gInfo
|
||||
liftIO $ putStrLn "APIDeleteChat CTGroup: clearGroupContent"
|
||||
withChatLock . procCmd $ do
|
||||
when (memberActive membership) . void $ sendGroupMessage gInfo members XGrpDel
|
||||
liftIO $ putStrLn "APIDeleteChat CTGroup: sendGroupMessage"
|
||||
mapM_ deleteMemberConnection members
|
||||
liftIO $ putStrLn "APIDeleteChat CTGroup: deleteMemberConnection"
|
||||
-- two functions below are called in separate transactions to prevent crashes on android
|
||||
-- (possibly, race condition on integrity check?)
|
||||
withStore' $ \db -> deleteGroupConnectionsAndFiles db user gInfo members
|
||||
liftIO $ putStrLn "APIDeleteChat CTGroup: deleteGroupConnectionsAndFiles"
|
||||
withStore' $ \db -> deleteGroupItemsAndMembers db user gInfo
|
||||
liftIO $ putStrLn "APIDeleteChat CTGroup: deleteGroupItemsAndMembers"
|
||||
withStore' $ \db -> deleteGroup db user gInfo
|
||||
liftIO $ putStrLn "APIDeleteChat CTGroup: deleteGroup"
|
||||
pure $ CRGroupDeletedUser gInfo
|
||||
CTContactRequest -> pure $ chatCmdError "not supported"
|
||||
APIClearChat (ChatRef cType chatId) -> withUser $ \user@User {userId} -> case cType of
|
||||
|
|
|
@ -1345,29 +1345,19 @@ getGroup db user groupId = do
|
|||
|
||||
deleteGroupConnectionsAndFiles :: DB.Connection -> User -> GroupInfo -> [GroupMember] -> IO ()
|
||||
deleteGroupConnectionsAndFiles db User {userId} GroupInfo {groupId} members = do
|
||||
putStrLn "deleteGroupConnectionsAndFiles"
|
||||
forM_ members $ \m -> DB.execute db "DELETE FROM connections WHERE user_id = ? AND group_member_id = ?" (userId, groupMemberId' m)
|
||||
putStrLn "deleteGroupConnectionsAndFiles: connections"
|
||||
DB.execute db "DELETE FROM files WHERE user_id = ? AND group_id = ?" (userId, groupId)
|
||||
putStrLn "deleteGroupConnectionsAndFiles: files"
|
||||
|
||||
deleteGroupItemsAndMembers :: DB.Connection -> User -> GroupInfo -> IO ()
|
||||
deleteGroupItemsAndMembers db User {userId} GroupInfo {groupId} = do
|
||||
putStrLn "deleteGroupItemsAndMembers"
|
||||
DB.execute db "DELETE FROM chat_items WHERE user_id = ? AND group_id = ?" (userId, groupId)
|
||||
putStrLn "deleteGroupItemsAndMembers: chat_items"
|
||||
DB.execute db "DELETE FROM group_members WHERE user_id = ? AND group_id = ?" (userId, groupId)
|
||||
putStrLn "deleteGroupItemsAndMembers: group_members"
|
||||
|
||||
deleteGroup :: DB.Connection -> User -> GroupInfo -> IO ()
|
||||
deleteGroup db User {userId} GroupInfo {groupId, localDisplayName} = do
|
||||
putStrLn "deleteGroup"
|
||||
deleteGroupProfile_ db userId groupId
|
||||
putStrLn "deleteGroup: deleteGroupProfile_"
|
||||
DB.execute db "DELETE FROM groups WHERE user_id = ? AND group_id = ?" (userId, groupId)
|
||||
putStrLn "deleteGroup: groups"
|
||||
DB.execute db "DELETE FROM display_names WHERE user_id = ? AND local_display_name = ?" (userId, localDisplayName)
|
||||
putStrLn "deleteGroup: display_names"
|
||||
|
||||
deleteGroupProfile_ :: DB.Connection -> UserId -> GroupId -> IO ()
|
||||
deleteGroupProfile_ db userId groupId =
|
||||
|
|
|
@ -861,6 +861,7 @@ viewChatError = \case
|
|||
[ "error: connection authorization failed - this could happen if connection was deleted,\
|
||||
\ secured with different credentials, or due to a bug - please re-create the connection"
|
||||
]
|
||||
AGENT A_DUPLICATE -> []
|
||||
e -> ["smp agent error: " <> sShow e]
|
||||
where
|
||||
fileNotFound fileId = ["file " <> sShow fileId <> " not found"]
|
||||
|
|
Loading…
Add table
Reference in a new issue