Improved error handling.
This commit is contained in:
parent
93b527ad85
commit
3ad13472d8
2 changed files with 23 additions and 12 deletions
|
@ -775,10 +775,19 @@ class ChatWindow extends App.Controller
|
|||
# cleanup params
|
||||
fqdn = App.Config.get('fqdn')
|
||||
http_type = App.Config.get('http_type')
|
||||
url = ''
|
||||
session = @session
|
||||
|
||||
# in case we do not have a model, create one
|
||||
if session && !session.uiUrl
|
||||
session = new App.ChatSession(session)
|
||||
if session && session.uiUrl
|
||||
url = session.uiUrl()
|
||||
|
||||
clean_params =
|
||||
id: id
|
||||
prefilledParams:
|
||||
body: "#{http_type}://#{fqdn}#{@session.uiUrl()}"
|
||||
body: "#{http_type}://#{fqdn}/#{url}"
|
||||
title: 'Chat'
|
||||
|
||||
App.TaskManager.execute(
|
||||
|
|
|
@ -13,18 +13,20 @@ class Sessions::Event::ChatStatusCustomer < Sessions::Event::ChatBase
|
|||
|
||||
# update recipients of existing sessions
|
||||
chat_session = Chat::Session.find_by(session_id: session_id)
|
||||
chat_session.add_recipient(@client_id, true)
|
||||
if chat_session
|
||||
chat_session.add_recipient(@client_id, true)
|
||||
|
||||
# sent url update to agent
|
||||
if @payload['data']['url']
|
||||
message = {
|
||||
event: 'chat_session_notice',
|
||||
data: {
|
||||
session_id: chat_session.session_id,
|
||||
message: @payload['data']['url'],
|
||||
},
|
||||
}
|
||||
chat_session.send_to_recipients(message, @client_id)
|
||||
# sent url update to agent
|
||||
if @payload['data']['url']
|
||||
message = {
|
||||
event: 'chat_session_notice',
|
||||
data: {
|
||||
session_id: chat_session.session_id,
|
||||
message: @payload['data']['url'],
|
||||
},
|
||||
}
|
||||
chat_session.send_to_recipients(message, @client_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue