2017-11-24 01:05:53 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Admin::ActionLogsHelper
|
|
|
|
def log_target(log)
|
2022-08-25 18:39:40 +00:00
|
|
|
case log.target_type
|
2019-03-15 15:57:23 +00:00
|
|
|
when 'Account'
|
2022-11-03 15:06:42 +00:00
|
|
|
link_to (log.human_identifier.presence || I18n.t('admin.action_logs.deleted_account')), admin_account_path(log.target_id)
|
2019-03-15 15:57:23 +00:00
|
|
|
when 'User'
|
2022-11-03 15:06:42 +00:00
|
|
|
if log.route_param.present?
|
|
|
|
link_to log.human_identifier, admin_account_path(log.route_param)
|
|
|
|
else
|
|
|
|
I18n.t('admin.action_logs.deleted_account')
|
|
|
|
end
|
2022-08-25 18:39:40 +00:00
|
|
|
when 'UserRole'
|
|
|
|
link_to log.human_identifier, admin_roles_path(log.target_id)
|
2019-03-15 15:57:23 +00:00
|
|
|
when 'Report'
|
2022-11-03 15:06:42 +00:00
|
|
|
link_to "##{log.human_identifier.presence || log.target_id}", admin_report_path(log.target_id)
|
2024-06-14 07:54:09 +00:00
|
|
|
when 'Instance', 'DomainBlock', 'DomainAllow', 'UnavailableDomain'
|
|
|
|
log.human_identifier.present? ? link_to(log.human_identifier, admin_instance_path(log.human_identifier)) : I18n.t('admin.action_logs.unavailable_instance')
|
2019-03-15 15:57:23 +00:00
|
|
|
when 'Status'
|
2022-08-25 18:39:40 +00:00
|
|
|
link_to log.human_identifier, log.permalink
|
2019-03-15 15:57:23 +00:00
|
|
|
when 'AccountWarning'
|
2023-01-24 17:50:13 +00:00
|
|
|
link_to log.human_identifier, disputes_strike_path(log.target_id)
|
2020-01-23 21:00:13 +00:00
|
|
|
when 'Announcement'
|
2022-08-25 18:39:40 +00:00
|
|
|
link_to truncate(log.human_identifier), edit_admin_announcement_path(log.target_id)
|
2024-06-14 07:54:09 +00:00
|
|
|
when 'IpBlock', 'EmailDomainBlock', 'CustomEmoji'
|
2022-08-25 18:39:40 +00:00
|
|
|
log.human_identifier
|
2022-08-28 01:31:54 +00:00
|
|
|
when 'CanonicalEmailBlock'
|
2022-11-03 15:06:42 +00:00
|
|
|
content_tag(:samp, (log.human_identifier.presence || '')[0...7], title: log.human_identifier)
|
2022-02-14 20:27:53 +00:00
|
|
|
when 'Appeal'
|
2022-11-03 15:06:42 +00:00
|
|
|
if log.route_param.present?
|
|
|
|
link_to log.human_identifier, disputes_strike_path(log.route_param.presence)
|
|
|
|
else
|
|
|
|
I18n.t('admin.action_logs.deleted_account')
|
|
|
|
end
|
2024-11-12 08:35:08 +00:00
|
|
|
when 'Relay'
|
|
|
|
link_to log.human_identifier, admin_relays_path
|
2019-03-15 15:57:23 +00:00
|
|
|
end
|
|
|
|
end
|
2024-10-02 14:47:00 +00:00
|
|
|
|
|
|
|
def sorted_action_log_types
|
|
|
|
Admin::ActionLogFilter::ACTION_TYPE_MAP
|
|
|
|
.keys
|
|
|
|
.map { |key| [I18n.t("admin.action_logs.action_types.#{key}"), key] }
|
|
|
|
.sort_by(&:first)
|
|
|
|
end
|
2017-11-24 01:05:53 +00:00
|
|
|
end
|