mirror of https://github.com/tootsuite/mastodon
Add `by_latest_used` scope, move admin area recent IPs to partial (#29497)
parent
c70c39cad0
commit
f56309f5f0
|
@ -15,4 +15,6 @@ class UserIp < ApplicationRecord
|
||||||
self.primary_key = :user_id
|
self.primary_key = :user_id
|
||||||
|
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
||||||
|
scope :by_latest_used, -> { order(used_at: :desc) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -62,13 +62,7 @@
|
||||||
%td
|
%td
|
||||||
%time.formatted{ datetime: account.created_at.iso8601, title: l(account.created_at) }= l account.created_at
|
%time.formatted{ datetime: account.created_at.iso8601, title: l(account.created_at) }= l account.created_at
|
||||||
%td
|
%td
|
||||||
- recent_ips = account.user.ips.order(used_at: :desc).to_a
|
= render partial: 'admin/accounts/user_ip', collection: account.user.ips.by_latest_used
|
||||||
- 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)
|
|
||||||
%tr
|
%tr
|
||||||
%th= t('admin.accounts.most_recent_activity')
|
%th= t('admin.accounts.most_recent_activity')
|
||||||
%td
|
%td
|
||||||
|
|
|
@ -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)
|
Loading…
Reference in New Issue