Define account deletion cascade for user and admin deletes #355
Labels
No labels
automated
code-quality
component: admin dashboard
component: backend
component: billing
component: content management
component: faqs
component: game genres
component: game lists
component: game reviews
component: game search
component: games
component: internal notifications
component: platforms
component: security
component: tests
component: user api
component: user badges
component: user blogs
component: user consoles
component: user favorites
component: user friends
component: user notifications
component: user profiles
component: user site notifications
component: user wishlists
component: web design
dependencies
php
priority
high
priority
low
priority
medium
security-hotspot
source: codex
source: sonarqube
status
awaiting feedback
status
backlog
status
done
status
in progress
status
in queue
status
in review
status
needs codex review
status
needs investigation
status
wontfix
type: bug
type: documentation
type: feature
type: improvement
type: regression
type: task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MyVideoGameList/myvideogamelist.com#355
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Account deletion currently needs a consistent backend workflow so self-service deletion and admin soft-deletion clean up the same user-owned data without leaving active records behind.
Self-service deletion should mark the account as user-deleted, invalidate the user's session, soft-delete the user row, and soft-delete the related user-owned rows listed below. Admin deletion should use the same cascade and session invalidation behavior, but should not set
users.user_deleted = 'Y'.Scope
users.user_deleted = 'Y'.users.user_deleted = 'Y'; only soft-delete the user and related records.deleted_at = now()andupdated_at = now():blog_commentswhereuser_idmatches the deleted user.blog_entrieswhereuser_idmatches the deleted user.console_listsfor the deleted user.favoritesfor the deleted user.user_friendswhere eitheruser_idorfriend_idmatches the deleted user.game_commentswhereuser_idmatches the deleted user.game_listswhereuser_idmatches the deleted user.user_gamer_tagsfor the deleted user.user_infosfor the deleted user.user_notification_settingsfor the deleted user.user_site_settingsfor the deleted user.usersrow for the deleted user.Acceptance Criteria
updated_atrefreshed to the deletion time.users.user_deleted = 'Y', soft-deletes the user row, and logs the user out.updated_atrefreshed to the deletion time.users.user_deletedtoY.user_idorfriend_id.Test Coverage Required
users.user_deleted = 'Y', user soft-delete, session invalidation, and every related table in scope.users.user_deleted = 'Y'.user_friendsrows are soft-deleted when the deleted user is eitheruser_idorfriend_id.updated_at.vendor/bin/pint --dirtybefore closing the issue.Progress Checklist
updated_atusers.user_deleted = 'Y'only for self-service deletionImplemented and pushed to
devin commitdf1eaff(Implement account deletion cascade).Notes:
App\Actions\DeleteUserAccountas the shared transactional cascade used by both self-service and admin deletion.users.user_deleted = 'Y'; admin deletion soft-deletes the account and scoped related rows without changinguser_deleted.deleted_atandupdated_atfor every scoped table, handlesuser_friendsfrom bothuser_idandfriend_id, removes database-backed sessions for the deleted user, and supports idempotent reruns viawithTrashed().Verification:
php artisan test --compact tests/Feature/AccountDeletionCascadeTest.php- 4 passed, 51 assertionsphp artisan test --compact tests/Feature/Settings/ProfileUpdateTest.php --filter='delete account'- 4 passed, 27 assertionsphp artisan test --compact tests/Feature/AdminUserProfileInfoTest.php- 1 passed, 11 assertionsvendor/bin/pint --dirty --format agent- passed