From 963bbb5396ff2d241cf54b63e33ae74798802226 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sun, 22 Mar 2015 12:59:39 +0100 Subject: [PATCH] Improved session overview. --- app/assets/javascripts/app/views/session.jst.eco | 4 ++-- app/controllers/application_controller.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/app/views/session.jst.eco b/app/assets/javascripts/app/views/session.jst.eco index 3e9ac61fb..a12771db5 100644 --- a/app/assets/javascripts/app/views/session.jst.eco +++ b/app/assets/javascripts/app/views/session.jst.eco @@ -16,8 +16,8 @@ <% for session in @sessions: %> <% if session.data.user: %><%= session.data.user.displayName() %><% end %> - <% if session.data.user_agent: %><%= session.data.user_agent %><% end %> - <% if session.data.geo: %><%= session.data.geo.country_code %> <%= session.data.geo.city %><% end %> + <%= session.data.user_agent %> + <% if session.data.geo && session.data.geo.country_name: %><%= session.data.geo.country_name %> <%= session.data.geo.city_name %><% else: %><%= session.data.remote_id %><% end %> ? ? diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index bf9d7b363..1825e0c54 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -83,7 +83,7 @@ class ApplicationController < ActionController::Base #session[:ping] = Time.now.utc.iso8601 session[:ping] = DateTime.now.iso8601 - # check if remote ip need to be updated @TODO Move this into model + # check if remote ip need to be updated if !session[:remote_id] || session[:remote_id] != request.remote_ip session[:remote_id] = request.remote_ip session[:geo] = GeoIp.location( request.remote_ip )