Fixed Rails namespace lookup issue and removed remaining foreign key records in Token table when deleting a user.
This commit is contained in:
parent
9d860fbc03
commit
ccbf10cb7a
2 changed files with 4 additions and 0 deletions
|
@ -1166,6 +1166,7 @@ raise 'Minimum one user need to have admin permissions'
|
|||
::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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue