trabajo-afectivo/lib/sessions/event/chat_status_agent.rb

28 lines
527 B
Ruby
Raw Normal View History

2015-11-10 14:01:04 +00:00
class Sessions::Event::ChatStatusAgent
def self.run(_data, session, _client_id)
# check if user has permissions
# check if feature is enabled
if !Setting.get('chat')
return {
event: 'chat_status_agent',
data: {
state: 'chat_disabled',
},
}
end
# renew timestamps
state = Chat::Agent.state(session['id'])
Chat::Agent.state(session['id'], state)
{
event: 'chat_status_agent',
data: Chat.agent_state(session['id']),
}
end
end