Fixed issue #2218 - CTI Caller Log blocks user deletion/destroy and fails
This commit is contained in:
parent
ec74d56b77
commit
2774bc207d
3 changed files with 28 additions and 11 deletions
|
@ -98,6 +98,10 @@ returns
|
|||
# set user id
|
||||
user_id = record[:created_by_id]
|
||||
if model == User
|
||||
if record.destroyed?
|
||||
Cti::CallerId.where(user_id: user_id).destroy_all
|
||||
return
|
||||
end
|
||||
user_id = record.id
|
||||
end
|
||||
return if !user_id
|
||||
|
|
|
@ -1157,15 +1157,15 @@ raise 'Minimum one user need to have admin permissions'
|
|||
end
|
||||
|
||||
def destroy_longer_required_objects
|
||||
Authorization.where(user_id: id).destroy_all
|
||||
Avatar.remove('User', id)
|
||||
Cti::CallerId.where(user_id: id).destroy_all
|
||||
Taskbar.where(user_id: id).destroy_all
|
||||
Karma::ActivityLog.where(user_id: id).destroy_all
|
||||
Karma::User.where(user_id: id).destroy_all
|
||||
OnlineNotification.where(user_id: id).destroy_all
|
||||
RecentView.where(created_by_id: id).destroy_all
|
||||
UserDevice.remove(id)
|
||||
::Authorization.where(user_id: id).destroy_all
|
||||
::Avatar.remove('User', id)
|
||||
::Cti::CallerId.where(user_id: id).destroy_all
|
||||
::Taskbar.where(user_id: id).destroy_all
|
||||
::Karma::ActivityLog.where(user_id: id).destroy_all
|
||||
::Karma::User.where(user_id: id).destroy_all
|
||||
::OnlineNotification.where(user_id: id).destroy_all
|
||||
::RecentView.where(created_by_id: id).destroy_all
|
||||
::UserDevice.remove(id)
|
||||
true
|
||||
end
|
||||
|
||||
|
|
|
@ -325,7 +325,7 @@ Mob: +49 333 8362222",
|
|||
|
||||
end
|
||||
|
||||
test '4 touch caller log / don\'t touch caller log' do
|
||||
test '4 touch caller log / don\'t touch caller log' do
|
||||
5.times do |count|
|
||||
travel 2.seconds
|
||||
Cti::Log.process(
|
||||
|
@ -477,7 +477,7 @@ Mob: +49 333 8362222",
|
|||
|
||||
end
|
||||
|
||||
test '5 probe if caller log need to be pushed' do
|
||||
test '5 probe if caller log need to be pushed' do
|
||||
|
||||
Cti::Log.process(
|
||||
'cause' => '',
|
||||
|
@ -534,4 +534,17 @@ Mob: +49 333 8362222",
|
|||
|
||||
end
|
||||
|
||||
test 'user delete with caller log rebuild' do
|
||||
assert_equal(2, Cti::CallerId.where(user_id: @agent2.id).count)
|
||||
|
||||
@agent2.destroy!
|
||||
|
||||
assert_equal(0, Cti::CallerId.where(user_id: @agent2.id).count)
|
||||
|
||||
Observer::Transaction.commit
|
||||
Scheduler.worker(true)
|
||||
|
||||
assert_equal(0, Cti::CallerId.where(user_id: @agent2.id).count)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue