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.
This commit is contained in:
Claire
2022-01-16 18:11:20 +01:00
24 changed files with 151 additions and 84 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