In reopenSesssion, scroll to bottom. Remove sessionID on close.

This commit is contained in:
Martin Edenhofer 2015-11-12 17:15:58 +01:00
parent 61cb35c193
commit 6b4c6ab12a

View file

@ -138,7 +138,7 @@ do($ = window.jQuery, window) ->
@onConnectionEstablished(data) @onConnectionEstablished(data)
for message in data.session for message in data.session
@log 'debug', "message in session", message @log 'debug', 'message in session', message
@renderMessage @renderMessage
message: message.content message: message.content
id: message.id id: message.id
@ -149,6 +149,7 @@ do($ = window.jQuery, window) ->
@show() @show()
@open() @open()
@scrollToBottom()
if unfinishedMessage if unfinishedMessage
@input.focus() @input.focus()
@ -256,7 +257,7 @@ do($ = window.jQuery, window) ->
close: (event) => close: (event) =>
event.stopPropagation() if event event.stopPropagation() if event
@ws.close() #@ws.close()
sessionStorage.removeItem 'sessionId' sessionStorage.removeItem 'sessionId'
sessionStorage.removeItem 'unfinished_message' sessionStorage.removeItem 'unfinished_message'
@ -275,6 +276,8 @@ do($ = window.jQuery, window) ->
@send 'chat_session_close', @send 'chat_session_close',
session_id: @sessionId session_id: @sessionId
@setSessionId undefined
hide: -> hide: ->
@el.removeClass('zammad-chat-is-visible') @el.removeClass('zammad-chat-is-visible')
@ -427,6 +430,9 @@ do($ = window.jQuery, window) ->
setSessionId: (id) => setSessionId: (id) =>
@sessionId = id @sessionId = id
if id is undefined
sessionStorage.removeItem 'sessionId'
else
sessionStorage.setItem 'sessionId', id sessionStorage.setItem 'sessionId', id
onConnectionEstablished: (data) => onConnectionEstablished: (data) =>