summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmelia Smith <ThisIsMissEm@users.noreply.github.com>2024-06-14 09:54:09 +0200
committerGitHub <noreply@github.com>2024-06-14 07:54:09 +0000
commit3d9f00ae167a40835a571a97ea5afcc85ec6e396 (patch)
tree287a62e5ed8514fe2e6ceeb4c611a15565b116f6
parenta243963e934123e17519711ce0378eaa7b5f8204 (diff)
Fix unsafe URLs in audit log resulting from domain blocks (#27139)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
-rw-r--r--app/helpers/admin/action_logs_helper.rb6
-rw-r--r--config/locales/en.yml1
2 files changed, 4 insertions, 3 deletions
diff --git a/app/helpers/admin/action_logs_helper.rb b/app/helpers/admin/action_logs_helper.rb
index 4018ef6b1c5..e8d56341262 100644
--- a/app/helpers/admin/action_logs_helper.rb
+++ b/app/helpers/admin/action_logs_helper.rb
@@ -15,15 +15,15 @@ module Admin::ActionLogsHelper
link_to log.human_identifier, admin_roles_path(log.target_id)
when 'Report'
link_to "##{log.human_identifier.presence || log.target_id}", admin_report_path(log.target_id)
- when 'DomainBlock', 'DomainAllow', 'EmailDomainBlock', 'UnavailableDomain'
- link_to log.human_identifier, "https://#{log.human_identifier.presence}"
+ 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')
when 'Status'
link_to log.human_identifier, log.permalink
when 'AccountWarning'
link_to log.human_identifier, disputes_strike_path(log.target_id)
when 'Announcement'
link_to truncate(log.human_identifier), edit_admin_announcement_path(log.target_id)
- when 'IpBlock', 'Instance', 'CustomEmoji'
+ when 'IpBlock', 'EmailDomainBlock', 'CustomEmoji'
log.human_identifier
when 'CanonicalEmailBlock'
content_tag(:samp, (log.human_identifier.presence || '')[0...7], title: log.human_identifier)
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 43aa8481c64..20df80c272f 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -293,6 +293,7 @@ en:
filter_by_action: Filter by action
filter_by_user: Filter by user
title: Audit log
+ unavailable_instance: "(domain name unavailable)"
announcements:
destroyed_msg: Announcement successfully deleted!
edit: