summaryrefslogtreecommitdiff
path: root/users/app
diff options
context:
space:
mode:
Diffstat (limited to 'users/app')
-rw-r--r--users/app/models/account.rb4
-rw-r--r--users/app/models/identity.rb12
2 files changed, 13 insertions, 3 deletions
diff --git a/users/app/models/account.rb b/users/app/models/account.rb
index 5368a1b..726f642 100644
--- a/users/app/models/account.rb
+++ b/users/app/models/account.rb
@@ -29,9 +29,7 @@ class Account
def destroy
return unless @user
- Identity.by_user_id.key(@user.id).each do |identity|
- identity.destroy
- end
+ Identity.disable_all_for(@user)
@user.destroy
end
diff --git a/users/app/models/identity.rb b/users/app/models/identity.rb
index e0a24e9..c24af73 100644
--- a/users/app/models/identity.rb
+++ b/users/app/models/identity.rb
@@ -50,6 +50,12 @@ class Identity < CouchRest::Model::Base
identity
end
+ def self.disable_all_for(user)
+ Identity.by_user_id.key(user.id).each do |identity|
+ identity.disable
+ end
+ end
+
def self.attributes_from_user(user)
{ user_id: user.id,
address: user.email_address,
@@ -57,6 +63,12 @@ class Identity < CouchRest::Model::Base
}
end
+ #
+ # about to change towards actually disabling the identity instead of
+ # destroying it.
+ #
+ alias_method :disable, :destroy
+
def keys
read_attribute('keys') || HashWithIndifferentAccess.new
end