Do not show chat in navbar until chat is enabled.
This commit is contained in:
parent
9d2bd0051c
commit
a5a1f41423
3 changed files with 24 additions and 9 deletions
|
@ -80,6 +80,11 @@ class App.CustomerChat extends App.Controller
|
||||||
active: @meta.active
|
active: @meta.active
|
||||||
)
|
)
|
||||||
|
|
||||||
|
featureActive: =>
|
||||||
|
if @Config.get('chat')
|
||||||
|
return true
|
||||||
|
false
|
||||||
|
|
||||||
render: ->
|
render: ->
|
||||||
if !@isRole('Chat')
|
if !@isRole('Chat')
|
||||||
@renderScreenUnauthorized(objectName: 'Chat')
|
@renderScreenUnauthorized(objectName: 'Chat')
|
||||||
|
@ -713,4 +718,4 @@ class Setting extends App.ControllerModal
|
||||||
|
|
||||||
App.Config.set( 'customer_chat', CustomerChatRouter, 'Routes' )
|
App.Config.set( 'customer_chat', CustomerChatRouter, 'Routes' )
|
||||||
App.Config.set( 'CustomerChat', { controller: 'CustomerChat', authentication: true }, 'permanentTask' )
|
App.Config.set( 'CustomerChat', { controller: 'CustomerChat', authentication: true }, 'permanentTask' )
|
||||||
App.Config.set( 'CustomerChat', { prio: 1200, parent: '', name: 'Customer Chat', target: '#customer_chat', key: 'CustomerChat', role: ['Chat'], class: 'chat' }, 'NavBar' )
|
App.Config.set( 'CustomerChat', { prio: 1200, parent: '', name: 'Customer Chat', target: '#customer_chat', key: 'CustomerChat', shown: false, role: ['Chat'], class: 'chat' }, 'NavBar' )
|
||||||
|
|
|
@ -50,7 +50,11 @@ class App.Navigation extends App.ControllerWidgetPermanent
|
||||||
items = @getItems( navbar: @Config.get( 'NavBar' ) )
|
items = @getItems( navbar: @Config.get( 'NavBar' ) )
|
||||||
|
|
||||||
# apply counter and switch info from persistant controllers (if exists)
|
# apply counter and switch info from persistant controllers (if exists)
|
||||||
|
itemsNew = []
|
||||||
for item in items
|
for item in items
|
||||||
|
shown = true
|
||||||
|
if item.shown isnt undefined
|
||||||
|
shown = item.shown
|
||||||
if item.key
|
if item.key
|
||||||
worker = App.TaskManager.worker(item.key)
|
worker = App.TaskManager.worker(item.key)
|
||||||
if worker
|
if worker
|
||||||
|
@ -58,6 +62,14 @@ class App.Navigation extends App.ControllerWidgetPermanent
|
||||||
item.counter = worker.counter()
|
item.counter = worker.counter()
|
||||||
if worker.switch
|
if worker.switch
|
||||||
item.switch = worker.switch()
|
item.switch = worker.switch()
|
||||||
|
if worker.featureActive
|
||||||
|
if worker.featureActive()
|
||||||
|
shown = true
|
||||||
|
else
|
||||||
|
shown = false
|
||||||
|
if shown
|
||||||
|
itemsNew.push item
|
||||||
|
items = itemsNew
|
||||||
|
|
||||||
# get open tabs to repopen on rerender
|
# get open tabs to repopen on rerender
|
||||||
open_tab = {}
|
open_tab = {}
|
||||||
|
|
|
@ -29,16 +29,14 @@ class ChatTest < TestCase
|
||||||
css: '#content .js-chatSetting',
|
css: '#content .js-chatSetting',
|
||||||
type: 'off',
|
type: 'off',
|
||||||
)
|
)
|
||||||
sleep 25 # wait for rerendering
|
|
||||||
click(
|
# nav bar shuld be gone
|
||||||
|
sleep 2
|
||||||
|
exists_not(
|
||||||
browser: agent,
|
browser: agent,
|
||||||
css: 'a[href="#customer_chat"]',
|
css: 'a[href="#customer_chat"]',
|
||||||
)
|
)
|
||||||
match(
|
sleep 15
|
||||||
browser: agent,
|
|
||||||
css: '.active.content',
|
|
||||||
value: 'disabled',
|
|
||||||
)
|
|
||||||
|
|
||||||
customer = browser_instance
|
customer = browser_instance
|
||||||
location(
|
location(
|
||||||
|
|
Loading…
Reference in a new issue