Remove IP tracking columns from users table (#16409)
This commit is contained in:
parent
b52fdb4c6f
commit
8e84ebf0cb
19 changed files with 141 additions and 75 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue