2022-01-01 13:38:12 +00:00
|
|
|
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
2021-06-01 12:20:20 +00:00
|
|
|
|
2016-03-25 07:45:21 +00:00
|
|
|
class Sessions::Event::ChatSessionNotice < Sessions::Event::ChatBase
|
|
|
|
|
2019-11-21 07:47:05 +00:00
|
|
|
=begin
|
|
|
|
|
|
|
|
a customer action has triggered a notice to the agent (e. g. view url of customer has changed)
|
|
|
|
|
|
|
|
payload
|
|
|
|
|
|
|
|
{
|
|
|
|
event: 'chat_session_notice',
|
|
|
|
data: {
|
|
|
|
message: 'url has changed to http://localhost',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
return is sent as message back to peer
|
|
|
|
|
|
|
|
=end
|
|
|
|
|
2016-03-25 07:45:21 +00:00
|
|
|
def run
|
|
|
|
return super if super
|
|
|
|
return if !check_chat_session_exists
|
2018-10-09 06:17:41 +00:00
|
|
|
|
2016-03-25 07:45:21 +00:00
|
|
|
chat_session = current_chat_session
|
|
|
|
return if !chat_session
|
|
|
|
return if !@payload['data']['message']
|
|
|
|
|
|
|
|
message = {
|
|
|
|
event: 'chat_session_notice',
|
2018-12-19 17:31:51 +00:00
|
|
|
data: {
|
2016-03-25 07:45:21 +00:00
|
|
|
session_id: chat_session.session_id,
|
2018-12-19 17:31:51 +00:00
|
|
|
message: @payload['data']['message'],
|
2016-03-25 07:45:21 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
chat_session.send_to_recipients(message, @client_id)
|
|
|
|
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|