chat client: fix new session initiation

This commit is contained in:
Felix Niklas 2015-11-12 15:30:44 +01:00
parent 240d552339
commit 2b8bd3a87c

View file

@ -146,9 +146,7 @@ do($ = window.jQuery, window) ->
@input.val unfinishedMessage @input.val unfinishedMessage
@show() @show()
@open @open()
showLoader: false
animate: false
if unfinishedMessage if unfinishedMessage
@input.focus() @input.focus()
@ -232,16 +230,16 @@ do($ = window.jQuery, window) ->
@el.find('.zammad-chat-body').append @view('message')(data) @el.find('.zammad-chat-body').append @view('message')(data)
@scrollToBottom() @scrollToBottom()
open: (options = { showLoader: true, animate: true }) => open: =>
return if @isOpen return if @isOpen
if options.showLoader if !@sessionId
@showLoader() @showLoader()
@el @el
.addClass('zammad-chat-is-open') .addClass('zammad-chat-is-open')
if options.animate if !@sessionId
@el.animate { bottom: 0 }, 500, @onOpenAnimationEnd @el.animate { bottom: 0 }, 500, @onOpenAnimationEnd
else else
@el.css 'bottom', 0 @el.css 'bottom', 0
@ -250,11 +248,8 @@ do($ = window.jQuery, window) ->
@isOpen = true @isOpen = true
onOpenAnimationEnd: => onOpenAnimationEnd: =>
#setTimeout @onQueue, 1180 if !@sessionId
# setTimeout @onConnectionEstablished, 1180 @session_init()
# setTimeout @onAgentTypingStart, 2000
# setTimeout @receiveMessage, 5000, "Hello! How can I help you?"
@session_init()
close: (event) => close: (event) =>
event.stopPropagation() if event event.stopPropagation() if event