diff --git a/app/controllers/v1/users_controller.rb b/app/controllers/v1/users_controller.rb index d57db6f6bc78c14c5d6ba4b01276b37a927e9cef..2e840d9c6405a79157064d6b4d402e84911a8b69 100644 --- a/app/controllers/v1/users_controller.rb +++ b/app/controllers/v1/users_controller.rb @@ -30,7 +30,7 @@ module V1 end def destroy - @user.account.destroy + @user.account.destroy(params[:identities] == "destroy") if @user == current_user logout end diff --git a/app/models/account.rb b/app/models/account.rb index 67fec5898cc85a637ea979d3529ba55459b3fb31..d13c929ac22e8cd87077001bcfc4305559b2e09e 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -47,9 +47,13 @@ class Account @user.refresh_identity end - def destroy + def destroy(destroy_identity=false) return unless @user - Identity.disable_all_for(@user) + if destroy_identity == false + Identity.disable_all_for(@user) + else + Identity.destroy_all_for(@user) + end @user.destroy end diff --git a/engines/support/app/models/account_extension/tickets.rb b/engines/support/app/models/account_extension/tickets.rb index f898b56512ad850cc4676114f6effb515c83ac20..f38d5fd352261c6b1b7a0717aa71fc0b66945a28 100644 --- a/engines/support/app/models/account_extension/tickets.rb +++ b/engines/support/app/models/account_extension/tickets.rb @@ -1,9 +1,9 @@ module AccountExtension::Tickets extend ActiveSupport::Concern - def destroy_with_tickets + def destroy_with_tickets(destroy_identities=false) Ticket.destroy_all_from(self.user) - destroy_without_tickets + destroy_without_tickets(destroy_identities) end included do