about summary refs log tree commit diff
path: root/app/helpers/admin
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-01-16 13:23:50 +0100
committerGitHub <noreply@github.com>2022-01-16 13:23:50 +0100
commit8e84ebf0cb211c1d94145399b05c9f2ad0e4d4b0 (patch)
treeebd30c6287a50f6b8c21700b8a3000c4f45070a1 /app/helpers/admin
parentb52fdb4c6f28b6f09861f1bc856079bb60391055 (diff)
Remove IP tracking columns from users table (#16409)
Diffstat (limited to 'app/helpers/admin')
-rw-r--r--app/helpers/admin/dashboard_helper.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/app/helpers/admin/dashboard_helper.rb b/app/helpers/admin/dashboard_helper.rb
index 32aaf9f5e..d4a30b97e 100644
--- a/app/helpers/admin/dashboard_helper.rb
+++ b/app/helpers/admin/dashboard_helper.rb
@@ -2,17 +2,17 @@
 
 module Admin::DashboardHelper
   def relevant_account_ip(account, ip_query)
-    default_ip = [account.user_current_sign_in_ip || account.user_sign_up_ip]
+    ips = account.user.ips.to_a
 
     matched_ip = begin
       ip_query_addr = IPAddr.new(ip_query)
-      account.user.recent_ips.find { |(_, ip)| ip_query_addr.include?(ip) } || default_ip
+      ips.find { |ip| ip_query_addr.include?(ip.ip) } || ips.first
     rescue IPAddr::Error
-      default_ip
-    end.last
+      ips.first
+    end
 
     if matched_ip
-      link_to matched_ip, admin_accounts_path(ip: matched_ip)
+      link_to matched_ip.ip, admin_accounts_path(ip: matched_ip.ip)
     else
       '-'
     end