0
0
Fork 0

Add audit logs to Admin::InstancesController (#27386)

This commit is contained in:
Emelia Smith 2024-07-23 10:12:30 +02:00 committed by GitHub
parent 1b839d2cba
commit bb2e5a4b58
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 47 additions and 0 deletions

View file

@ -5,6 +5,14 @@ class Admin::ActionLogFilter
action_type
account_id
target_account_id
target_domain
).freeze
INSTANCE_TARGET_TYPES = %w(
DomainBlock
DomainAllow
Instance
UnavailableDomain
).freeze
ACTION_TYPE_MAP = {
@ -95,6 +103,9 @@ class Admin::ActionLogFilter
when 'target_account_id'
account = Account.find_or_initialize_by(id: value)
latest_action_logs.where(target: [account, account.user].compact)
when 'target_domain'
normalized_domain = TagManager.instance.normalize_domain(value)
latest_action_logs.where(human_identifier: normalized_domain, target_type: INSTANCE_TARGET_TYPES)
else
raise Mastodon::InvalidParameterError, "Unknown filter: #{key}"
end