diff options
author | Matt Jankowski <matt@jankowski.online> | 2024-04-02 09:51:34 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-02 13:51:34 +0000 |
commit | f56309f5f03f28d35c5e36b8cab282a03522370a (patch) | |
tree | da01a48bbafb74f9b6e63d4e406b427ce0851c35 /app/views/admin | |
parent | c70c39cad03824c64564fa7d241e6bf01acbab76 (diff) |
Add `by_latest_used` scope, move admin area recent IPs to partial (#29497)
Diffstat (limited to 'app/views/admin')
-rw-r--r-- | app/views/admin/accounts/_local_account.html.haml | 8 | ||||
-rw-r--r-- | app/views/admin/accounts/_user_ip.html.haml | 5 |
2 files changed, 6 insertions, 7 deletions
diff --git a/app/views/admin/accounts/_local_account.html.haml b/app/views/admin/accounts/_local_account.html.haml index 82197cda43d..3ed392cd1a5 100644 --- a/app/views/admin/accounts/_local_account.html.haml +++ b/app/views/admin/accounts/_local_account.html.haml @@ -62,13 +62,7 @@ %td %time.formatted{ datetime: account.created_at.iso8601, title: l(account.created_at) }= l account.created_at %td -- recent_ips = account.user.ips.order(used_at: :desc).to_a -- recent_ips.each_with_index do |recent_ip, i| - %tr - - if i.zero? - %th{ rowspan: recent_ips.size }= t('admin.accounts.most_recent_ip') - %td= recent_ip.ip - %td= table_link_to 'search', t('admin.accounts.search_same_ip'), admin_accounts_path(ip: recent_ip.ip) + = render partial: 'admin/accounts/user_ip', collection: account.user.ips.by_latest_used %tr %th= t('admin.accounts.most_recent_activity') %td diff --git a/app/views/admin/accounts/_user_ip.html.haml b/app/views/admin/accounts/_user_ip.html.haml new file mode 100644 index 00000000000..1938cf7edf0 --- /dev/null +++ b/app/views/admin/accounts/_user_ip.html.haml @@ -0,0 +1,5 @@ +%tr + - if user_ip_iteration.first? + %th{ rowspan: user_ip_iteration.size }= t('admin.accounts.most_recent_ip') + %td= user_ip.ip + %td= table_link_to 'search', t('admin.accounts.search_same_ip'), admin_accounts_path(ip: user_ip.ip) |