filter on contact deletion

This commit is contained in:
spaced4ndy 2024-02-19 12:05:40 +04:00
parent acf6519e23
commit 203d793cf0
2 changed files with 3 additions and 3 deletions

View File

@ -240,7 +240,7 @@ deleteContact db user@User {userId} Contact {contactId, localDisplayName, active
else do else do
currentTs <- getCurrentTime currentTs <- getCurrentTime
DB.execute db "UPDATE group_members SET contact_id = NULL, updated_at = ? WHERE user_id = ? AND contact_id = ?" (currentTs, userId, contactId) DB.execute db "UPDATE group_members SET contact_id = NULL, updated_at = ? WHERE user_id = ? AND contact_id = ?" (currentTs, userId, contactId)
DB.execute db "DELETE FROM contacts WHERE user_id = ? AND contact_id = ?" (userId, contactId) DB.execute db "DELETE FROM contacts WHERE user_id = ? AND contact_id = ? AND is_user = 0" (userId, contactId)
forM_ activeConn $ \Connection {customUserProfileId} -> forM_ activeConn $ \Connection {customUserProfileId} ->
forM_ customUserProfileId $ \profileId -> forM_ customUserProfileId $ \profileId ->
deleteUnusedIncognitoProfileById_ db user profileId deleteUnusedIncognitoProfileById_ db user profileId
@ -251,7 +251,7 @@ deleteContactWithoutGroups db user@User {userId} Contact {contactId, localDispla
DB.execute db "DELETE FROM chat_items WHERE user_id = ? AND contact_id = ?" (userId, contactId) DB.execute db "DELETE FROM chat_items WHERE user_id = ? AND contact_id = ?" (userId, contactId)
deleteContactProfile_ db userId contactId deleteContactProfile_ db userId contactId
DB.execute db "DELETE FROM display_names WHERE user_id = ? AND local_display_name = ?" (userId, localDisplayName) DB.execute db "DELETE FROM display_names WHERE user_id = ? AND local_display_name = ?" (userId, localDisplayName)
DB.execute db "DELETE FROM contacts WHERE user_id = ? AND contact_id = ?" (userId, contactId) DB.execute db "DELETE FROM contacts WHERE user_id = ? AND contact_id = ? AND is_user = 0" (userId, contactId)
forM_ activeConn $ \Connection {customUserProfileId} -> forM_ activeConn $ \Connection {customUserProfileId} ->
forM_ customUserProfileId $ \profileId -> forM_ customUserProfileId $ \profileId ->
deleteUnusedIncognitoProfileById_ db user profileId deleteUnusedIncognitoProfileById_ db user profileId

View File

@ -1656,7 +1656,7 @@ mergeContactRecords db user@User {userId} to@Contact {localDisplayName = keepLDN
":updated_at" := currentTs ":updated_at" := currentTs
] ]
deleteContactProfile_ db userId fromContactId deleteContactProfile_ db userId fromContactId
DB.execute db "DELETE FROM contacts WHERE contact_id = ? AND user_id = ?" (fromContactId, userId) DB.execute db "DELETE FROM contacts WHERE contact_id = ? AND user_id = ? AND is_user = 0" (fromContactId, userId)
deleteUnusedDisplayName_ db userId fromLDN deleteUnusedDisplayName_ db userId fromLDN
when (keepLDN /= toLDN && keepLDN == fromLDN) $ when (keepLDN /= toLDN && keepLDN == fromLDN) $
DB.execute DB.execute