diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-01-16 18:11:20 +0100 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2022-01-16 18:11:20 +0100 |
commit | b61c3ddff8338432fdc287f6bebbf76a12859c17 (patch) | |
tree | 702e67a92f3a6e84feed3c06126b14a7e4ecab35 /app/helpers/admin/dashboard_helper.rb | |
parent | 07cb948f39464b11959fc506b673a90d9524e519 (diff) | |
parent | 462bc65112276f4cbfbeb1efd8cd452fda7d0f23 (diff) |
Merge branch 'main' into glitch-soc/merge-upstream
Conflicts: - `README.md`: Upstream added some text, but our README is completely different. Kept our README unchanged.
Diffstat (limited to 'app/helpers/admin/dashboard_helper.rb')
-rw-r--r-- | app/helpers/admin/dashboard_helper.rb | 10 |
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 |