lets not set NOT NULL fields to null…
This commit is contained in:
parent
afb5e5e7f0
commit
fe82cd6609
2 changed files with 12 additions and 1 deletions
|
|
@ -151,6 +151,7 @@ class Profile < ActiveRecord::Base
|
|||
clearable_fields.each do |field|
|
||||
self[field] = nil
|
||||
end
|
||||
self[:searchable] = false
|
||||
self.save
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -499,6 +499,12 @@ class User < ActiveRecord::Base
|
|||
clearable_fields.each do |field|
|
||||
self[field] = nil
|
||||
end
|
||||
[:getting_started,
|
||||
:disable_mail,
|
||||
:show_community_spotlight_in_stream].each do |field|
|
||||
self[field] = false
|
||||
end
|
||||
self[:email] = "deletedaccount_#{self[:id]}@example.org"
|
||||
|
||||
random_password = ActiveSupport::SecureRandom.hex(20)
|
||||
self.password = random_password
|
||||
|
|
@ -508,6 +514,10 @@ class User < ActiveRecord::Base
|
|||
|
||||
private
|
||||
def clearable_fields
|
||||
self.attributes.keys - ["id", "username", "encrypted_password", "created_at", "updated_at", "locked_at", "serialized_private_key"]
|
||||
self.attributes.keys - ["id", "username", "encrypted_password",
|
||||
"created_at", "updated_at", "locked_at",
|
||||
"serialized_private_key", "getting_started",
|
||||
"disable_mail", "show_community_spotlight_in_stream",
|
||||
"email"]
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue