Fixes #2017 phone notify not clearing
This commit is contained in:
parent
ad3362e94c
commit
3a645d1c6e
3 changed files with 73 additions and 8 deletions
|
@ -10,6 +10,7 @@ class App.CTI extends App.Controller
|
|||
active: false
|
||||
counter: 0
|
||||
state: {}
|
||||
backendEnabled: false
|
||||
|
||||
constructor: ->
|
||||
super
|
||||
|
@ -29,9 +30,9 @@ class App.CTI extends App.Controller
|
|||
@meta.counter += 1
|
||||
@updateNavMenu()
|
||||
if data.state is 'answer' || data.state is 'hangup'
|
||||
return if !@meta.state[data.id]
|
||||
delete @meta.state[data.id]
|
||||
@meta.counter -= 1
|
||||
if @meta.state[data.id]
|
||||
delete @meta.state[data.id]
|
||||
@meta.counter -= 1
|
||||
@updateNavMenu()
|
||||
'cti_event'
|
||||
)
|
||||
|
@ -82,6 +83,17 @@ class App.CTI extends App.Controller
|
|||
App.Collection.loadAssets(data.assets)
|
||||
if data.backends
|
||||
@backends = data.backends
|
||||
|
||||
# check if configured backends are changed
|
||||
backendEnabled = false
|
||||
for backend in @backends
|
||||
if backend.enabled
|
||||
backendEnabled = true
|
||||
if backendEnabled isnt @backendEnabled
|
||||
@renderDone = false
|
||||
@backendEnabled = backendEnabled
|
||||
|
||||
# render new caller list
|
||||
if data.list
|
||||
@list = data.list
|
||||
if @renderDone
|
||||
|
@ -109,11 +121,7 @@ class App.CTI extends App.Controller
|
|||
return
|
||||
|
||||
# check if min one backend is enabled
|
||||
backendEnabled = false
|
||||
for backend in @backends
|
||||
if backend.enabled
|
||||
backendEnabled = true
|
||||
if !backendEnabled
|
||||
if !@backendEnabled
|
||||
@html App.view('cti/not_configured')(
|
||||
backends: @backends
|
||||
isAdmin: @permissionCheck('admin.integration')
|
||||
|
|
|
@ -65,6 +65,7 @@ if [ "$LEVEL" == '1' ]; then
|
|||
# test/browser/maintenance_session_message_test.rb
|
||||
# test/browser/manage_test.rb
|
||||
# test/browser/monitoring_test.rb
|
||||
rm test/browser/phone_notify_not_clearing_on_leftside_test.rb
|
||||
rm test/browser/preferences_language_test.rb
|
||||
rm test/browser/preferences_permission_check_test.rb
|
||||
rm test/browser/preferences_token_access_test.rb
|
||||
|
@ -137,6 +138,7 @@ elif [ "$LEVEL" == '2' ]; then
|
|||
rm test/browser/maintenance_session_message_test.rb
|
||||
rm test/browser/manage_test.rb
|
||||
rm test/browser/monitoring_test.rb
|
||||
rm test/browser/phone_notify_not_clearing_on_leftside_test.rb
|
||||
rm test/browser/preferences_language_test.rb
|
||||
rm test/browser/preferences_permission_check_test.rb
|
||||
rm test/browser/preferences_token_access_test.rb
|
||||
|
@ -209,6 +211,7 @@ elif [ "$LEVEL" == '3' ]; then
|
|||
rm test/browser/maintenance_session_message_test.rb
|
||||
rm test/browser/manage_test.rb
|
||||
rm test/browser/monitoring_test.rb
|
||||
rm test/browser/phone_notify_not_clearing_on_leftside_test.rb
|
||||
rm test/browser/preferences_language_test.rb
|
||||
rm test/browser/preferences_permission_check_test.rb
|
||||
rm test/browser/preferences_token_access_test.rb
|
||||
|
@ -281,6 +284,7 @@ elif [ "$LEVEL" == '4' ]; then
|
|||
rm test/browser/maintenance_session_message_test.rb
|
||||
rm test/browser/manage_test.rb
|
||||
rm test/browser/monitoring_test.rb
|
||||
rm test/browser/phone_notify_not_clearing_on_leftside_test.rb
|
||||
rm test/browser/preferences_language_test.rb
|
||||
rm test/browser/preferences_permission_check_test.rb
|
||||
rm test/browser/preferences_token_access_test.rb
|
||||
|
@ -352,6 +356,7 @@ elif [ "$LEVEL" == '5' ]; then
|
|||
rm test/browser/maintenance_session_message_test.rb
|
||||
rm test/browser/manage_test.rb
|
||||
rm test/browser/monitoring_test.rb
|
||||
rm test/browser/phone_notify_not_clearing_on_leftside_test.rb
|
||||
rm test/browser/preferences_language_test.rb
|
||||
rm test/browser/preferences_permission_check_test.rb
|
||||
rm test/browser/preferences_token_access_test.rb
|
||||
|
@ -426,6 +431,7 @@ elif [ "$LEVEL" == '6' ]; then
|
|||
rm test/browser/maintenance_session_message_test.rb
|
||||
rm test/browser/manage_test.rb
|
||||
rm test/browser/monitoring_test.rb
|
||||
# rm test/browser/phone_notify_not_clearing_on_leftside_test.rb
|
||||
# test/browser/preferences_language_test.rb
|
||||
# test/browser/preferences_permission_check_test.rb
|
||||
# test/browser/preferences_token_access_test.rb
|
||||
|
|
51
test/browser/phone_notify_not_clearing_on_leftside_test.rb
Normal file
51
test/browser/phone_notify_not_clearing_on_leftside_test.rb
Normal file
|
@ -0,0 +1,51 @@
|
|||
require 'browser_test_helper'
|
||||
|
||||
# Regression test for #2017
|
||||
|
||||
class PhoneNotifyNotClearingOnLeftsideTest < TestCase
|
||||
def test_notify_badge
|
||||
id = rand(99_999_999)
|
||||
|
||||
@browser = browser_instance
|
||||
login(
|
||||
username: 'master@example.com',
|
||||
password: 'test',
|
||||
url: browser_url,
|
||||
)
|
||||
|
||||
click(css: 'a[href="#manage"]')
|
||||
click(css: 'a[href="#system/integration"]')
|
||||
click(css: 'a[href="#system/integration/sipgate"]')
|
||||
|
||||
if !@browser.find_element(css: 'input[name=sipgate_integration]').property('checked')
|
||||
switch(
|
||||
css: '.active .js-switch',
|
||||
type: 'on'
|
||||
)
|
||||
end
|
||||
|
||||
watch_for(
|
||||
css: 'a[href="#cti"]'
|
||||
)
|
||||
|
||||
click(css: 'a[href="#cti"]')
|
||||
|
||||
# simulate sipgate callbacks
|
||||
|
||||
url = URI.join(browser_url, 'api/v1/sipgate/in')
|
||||
params = { direction: 'in', from: '491715000002', to: '4930600000000', callId: "4991155921769858278-#{id}", cause: 'busy' }
|
||||
Net::HTTP.post_form(url, params.merge(event: 'newCall'))
|
||||
Net::HTTP.post_form(url, params.merge(event: 'hangup'))
|
||||
|
||||
watch_for(
|
||||
css: '.js-phoneMenuItem .counter',
|
||||
value: '1'
|
||||
)
|
||||
|
||||
@browser.find_element(css: '.table-checkbox label').click
|
||||
|
||||
watch_for_disappear(
|
||||
css: '.js-phoneMenuItem .counter'
|
||||
)
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue