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:
evazion
2022-11-05 23:26:13 -05:00
parent 3ffde5b23d
commit b43a913ad7
7 changed files with 143 additions and 53 deletions

View File

@@ -9,17 +9,19 @@
<h1>Deactivate Account: <%= link_to_user @user %></h1>
<% end %>
<div class="prose mb-4">
<div class="prose mb-4 fixed-width-container">
<p>
You can deactivate your <%= Danbooru.config.app_name %> account by entering your password below. Deactivating
your account will do the following things:
</p>
You can deactivate your account by entering your password below. Deactivating your account will delete your
private account information, but it will not delete your contributions to the site.
</p>Deactivating your account will do the following things: </p>
<ul>
<li>Change your username to a generic username (<i>user_<%= @user.id %></i>).</li>
<li>Delete your password, email address, and account settings.</li>
<li>Delete your favorites.</li>
<li>Delete your saved searches.</li>
<li>Delete your password, email address, <%= link_to_wiki "API keys", "help:api" %>, and account settings.</li>
<li>Delete your <%= link_to_wiki "saved searches", "help:saved_searches" %>.</li>
<li>Delete your <%= link_to_wiki "private favorite groups", "help:favorite_groups" %>.</li>
<li>Delete your private favorites and upvotes (only if <%= link_to_wiki "privacy mode", "help:privacy_mode" %> is enabled).</li>
</ul>
<p>
@@ -33,6 +35,8 @@
<li>Your login history, including your IP address and geographic location. This is kept for moderation purposes.</li>
</ul>
<p>If you just want to change your username, you can <%= link_to "change your name here", change_name_user_path(@user) %>.</p>
<p>
Enter your password below to deactivate your account. This cannot be
undone. Your account cannot be recovered after it is deactivated.