From ef769ef2356465721cee883e649d9659262ef6a7 Mon Sep 17 00:00:00 2001 From: Peter Hankiewicz Date: Wed, 31 Aug 2022 21:44:24 +0200 Subject: [PATCH] Avoid double-redaction of senders/principals in defamations --- CHANGELOG.md | 4 ++++ app/models/defamation.rb | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 88385de9..272f08e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). It uses [CalVer](https://calver.org/) as of May 2019. +## [22.08d](https://github.com/berkmancenter/lumendatabase/releases/tag/2022.08d) - 2022-08-31 +### Fixed +* Fixed double-redaction of senders/principals in defamations. + ## [22.08c](https://github.com/berkmancenter/lumendatabase/releases/tag/2022.08c) - 2022-08-30 ### Changed * Started redacting sender and principal names in defamations. diff --git a/app/models/defamation.rb b/app/models/defamation.rb index 7c393861..a6851cfa 100644 --- a/app/models/defamation.rb +++ b/app/models/defamation.rb @@ -42,10 +42,16 @@ def auto_redact InstanceRedactor::EntityNameRedactor.new ] + entity_name = principal&.name || sender&.name + + # Some submitters redact on their end using this phrase, let's avoid + # double-redaction + return if entity_name == '[REDACTED]' + instance_redactor = InstanceRedactor.new( custom_redactors, { - entity_name: principal&.name || sender&.name + entity_name: entity_name } )