users: delete more data when user deactivates their account.
* Don't delete the user's favorites unless private favorites are enabled. The general rule is that public account activity is kept and private account activity is deleted. * Delete the user's API keys, forum topics visits, private favgroups, downvotes, and upvotes (if privacy is enabled). * Reset all of the user's account settings to default. This means custom CSS is deleted, where it wasn't before. * Delete everything but the user's name and password asynchronously. * Don't log the current user out if it's the owner deleting another user's account. * Fix #5067 (Mod actions sometimes not created for user deletions) by wrapping the deletion process in a transaction.
This commit is contained in:
@@ -46,11 +46,11 @@ class SessionLoader
|
||||
end
|
||||
|
||||
# Logs the current user out. Deletes their session cookie and records a logout event.
|
||||
def logout
|
||||
def logout(user = CurrentUser.user)
|
||||
session.delete(:user_id)
|
||||
session.delete(:last_authenticated_at)
|
||||
return if CurrentUser.user.is_anonymous?
|
||||
UserEvent.create_from_request!(CurrentUser.user, :logout, request)
|
||||
return if user.is_anonymous?
|
||||
UserEvent.create_from_request!(user, :logout, request)
|
||||
end
|
||||
|
||||
# Sets the current user. Runs on each HTTP request. The user is set based on
|
||||
|
||||
Reference in New Issue
Block a user