FEATURE: Remove more PII during user anonymizing

Removes
  * invite if the user was invited
  * email tokens
  * incoming emails
  * email log entries
  * raw emails from posts
This commit is contained in:
Gerhard Schlager
2018-06-07 12:17:37 +02:00
parent 22c186a792
commit cf038cf72a
2 changed files with 56 additions and 1 deletions

View File

@@ -63,6 +63,16 @@ class UserAnonymizer
acting_user_id: @actor ? @actor.id : @user.id,
}
Invite.with_deleted.where(user_id: @user.id).destroy_all
EmailToken.where(user_id: @user.id).destroy_all
EmailLog.where(user_id: @user.id).delete_all
IncomingEmail.where("user_id = ? OR from_address = ?", @user.id, @prev_email).delete_all
Post.with_deleted
.where(user_id: @user.id)
.where.not(raw_email: nil)
.update_all(raw_email: nil)
if SiteSetting.log_anonymizer_details?
history_details[:email] = @prev_email
history_details[:details] = "username: #{@prev_username}"