From fe82cd66093beedf18ea0508532fef890cdc42f0 Mon Sep 17 00:00:00 2001 From: Jonne Hass Date: Sun, 11 Dec 2011 04:12:58 +0100 Subject: [PATCH] =?UTF-8?q?lets=20not=20set=20NOT=20NULL=20fields=20to=20n?= =?UTF-8?q?ull=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/profile.rb | 1 + app/models/user.rb | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/models/profile.rb b/app/models/profile.rb index cdbb1b2be..4978bc80a 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -151,6 +151,7 @@ class Profile < ActiveRecord::Base clearable_fields.each do |field| self[field] = nil end + self[:searchable] = false self.save end diff --git a/app/models/user.rb b/app/models/user.rb index 303d86d6e..453e6cb84 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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