core: fix deletion of contact without connections (#3327)

This commit is contained in:
spaced4ndy
2023-11-08 13:15:08 +04:00
committed by GitHub
parent ee6bd0f839
commit 8722d35278
3 changed files with 12 additions and 6 deletions
+2 -2
View File
@@ -723,7 +723,7 @@ getPendingContactConnections db User {userId} = do
|]
[":user_id" := userId, ":conn_type" := ConnContact]
getContactConnections :: DB.Connection -> UserId -> Contact -> ExceptT StoreError IO [Connection]
getContactConnections :: DB.Connection -> UserId -> Contact -> IO [Connection]
getContactConnections db userId Contact {contactId} =
connections =<< liftIO getConnections_
where
@@ -739,7 +739,7 @@ getContactConnections db userId Contact {contactId} =
WHERE c.user_id = ? AND ct.user_id = ? AND ct.contact_id = ?
|]
(userId, userId, contactId)
connections [] = throwError $ SEContactNotFound contactId
connections [] = pure []
connections rows = pure $ map toConnection rows
getConnectionById :: DB.Connection -> User -> Int64 -> ExceptT StoreError IO Connection