0
0
Fork 0

Remove IP tracking columns from users table (#16409)

This commit is contained in:
Eugen Rochko 2022-01-16 13:23:50 +01:00 committed by GitHub
parent b52fdb4c6f
commit 8e84ebf0cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 141 additions and 75 deletions

View file

@ -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