diff --git a/app/assets/javascripts/app/controllers/chat.coffee b/app/assets/javascripts/app/controllers/chat.coffee index 23239899f..ee665c6b0 100644 --- a/app/assets/javascripts/app/controllers/chat.coffee +++ b/app/assets/javascripts/app/controllers/chat.coffee @@ -366,14 +366,8 @@ class ChatWindow extends App.Controller @isAgentTyping = false @resetUnreadMessages() - chat = App.Chat.find(@session.chat_id) - @name = "#{chat.displayName()} [##{@session.id}]" - @title = '' - if @session && @session.preferences && @session.preferences.geo_ip - if @session.preferences.geo_ip.country_name - @title += @session.preferences.geo_ip.country_name - if @session.preferences.geo_ip.city_name - @title += " #{@session.preferences.geo_ip.city_name}" + @chat = App.Chat.find(@session.chat_id) + @name = "#{@chat.displayName()} ##{@session.id}" @on 'layout-change', @scrollToBottom @@ -407,7 +401,6 @@ class ChatWindow extends App.Controller render: -> @html App.view('customer_chat/chat_window') name: @name - title: @title @el.one 'transitionend', @onTransitionend @@ -435,6 +428,21 @@ class ChatWindow extends App.Controller @input.html(phrase) @sendMessage(1600) + @$('.js-info').popover( + trigger: 'hover' + html: true + animation: false + delay: 0 + placement: 'bottom' + container: 'body' # place in body do prevent it from animating + title: -> + App.i18n.translateContent('Details') + content: => + App.view('customer_chat/chat_window_info')( + session: @session + ) + ) + focus: => @input.focus() diff --git a/app/assets/javascripts/app/views/customer_chat/chat_window.jst.eco b/app/assets/javascripts/app/views/customer_chat/chat_window.jst.eco index 9eb7f9cbb..71a51e9f0 100644 --- a/app/assets/javascripts/app/views/customer_chat/chat_window.jst.eco +++ b/app/assets/javascripts/app/views/customer_chat/chat_window.jst.eco @@ -6,7 +6,7 @@ <%- @Icon('small-dot', 'icon-status-modified-inner-circle') %> -
+
<%= @name %>
<%- @Icon('info') %>
diff --git a/app/assets/javascripts/app/views/customer_chat/chat_window_info.jst.eco b/app/assets/javascripts/app/views/customer_chat/chat_window_info.jst.eco new file mode 100644 index 000000000..6c90aa8a9 --- /dev/null +++ b/app/assets/javascripts/app/views/customer_chat/chat_window_info.jst.eco @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/lib/sessions/event/chat_session_init.rb b/lib/sessions/event/chat_session_init.rb index bef090545..0bab5a2be 100644 --- a/lib/sessions/event/chat_session_init.rb +++ b/lib/sessions/event/chat_session_init.rb @@ -10,6 +10,22 @@ class Sessions::Event::ChatSessionInit < Sessions::Event::ChatBase geo_ip = Service::GeoIp.location(@remote_ip) end + # dns lookup + dns_name = nil + if @remote_ip + begin + dns = Resolv::DNS.new + dns.timeouts = 3 + result = dns.getname @remote_ip + if result + dns_name = result.to_s + end + rescue => e + Rails.logger.error e.message + Rails.logger.error e.backtrace.inspect + end + end + # create chat session chat_session = Chat::Session.create( chat_id: @payload['data']['chat_id'], @@ -19,6 +35,7 @@ class Sessions::Event::ChatSessionInit < Sessions::Event::ChatBase participants: [@client_id], remote_ip: @remote_ip, geo_ip: geo_ip, + dns_name: dns_name, }, )