Permalink
Browse files

Fixed Rails namespace lookup issue and removed remaining foreign key …

…records in Token table when deleting a user.
  • Loading branch information...
thorsteneckel authored and Jens Pfeifer committed Sep 10, 2018
1 parent 9d860fb commit ccbf10cb7af882cd0609e87a2df76e270c1d6632
Showing with 4 additions and 0 deletions.
  1. +1 −0 app/models/user.rb
  2. +3 −0 test/unit/user_test.rb
View
@@ -1166,6 +1166,7 @@ def destroy_longer_required_objects
::OnlineNotification.where(user_id: id).destroy_all
::RecentView.where(created_by_id: id).destroy_all
::UserDevice.remove(id)
::Token.where(user_id: id).destroy_all
true
end
View
@@ -1258,6 +1258,8 @@ class UserTest < ActiveSupport::TestCase
RecentView.log(ticket1.class.to_s, ticket1.id, agent1)
assert_equal(1, RecentView.where(created_by_id: agent1_id).count)
Token.create!(action: 'api', user_id: agent1_id)
agent1.destroy!
assert_equal(0, UserDevice.where(user_id: agent1_id).count)
@@ -1268,6 +1270,7 @@ class UserTest < ActiveSupport::TestCase
assert_equal(0, Cti::CallerId.where(user_id: agent1_id).count)
assert_equal(0, Taskbar.where(user_id: agent1_id).count)
assert_equal(0, RecentView.where(created_by_id: agent1_id).count)
assert_equal(0, Token.where(user_id: agent1_id).count)
end
test 'adding group drops cache' do

0 comments on commit ccbf10c

Please sign in to comment.