Purge most user fields upon deletion, "right to be forgotten" #859

This commit is contained in:
Alex Gleason 2020-08-17 23:44:44 -05:00
parent c12c576ee2
commit 72cbe20a58
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7

View File

@ -1585,15 +1585,44 @@ def update_notification_settings(%User{} = user, settings) do
@spec purge_user_changeset(User.t()) :: Changeset.t() @spec purge_user_changeset(User.t()) :: Changeset.t()
def purge_user_changeset(user) do def purge_user_changeset(user) do
# "Right to be forgotten"
# https://gdpr.eu/right-to-be-forgotten/
change(user, %{ change(user, %{
deactivated: true, bio: nil,
raw_bio: nil,
email: nil, email: nil,
name: nil,
password_hash: nil,
keys: nil,
public_key: nil,
avatar: %{}, avatar: %{},
tags: [],
last_refreshed_at: nil,
last_digest_emailed_at: nil,
banner: %{}, banner: %{},
background: %{}, background: %{},
note_count: 0,
follower_count: 0,
following_count: 0,
locked: false,
confirmation_pending: false,
password_reset_pending: false,
approval_pending: false,
registration_reason: nil,
confirmation_token: nil,
domain_blocks: [],
deactivated: true,
ap_enabled: false,
is_moderator: false,
is_admin: false,
mastofe_settings: nil,
mascot: nil,
emoji: %{},
pleroma_settings_store: %{},
fields: [], fields: [],
bio: nil, raw_fields: [],
name: nil discoverable: false,
also_known_as: []
}) })
end end