main ← fix/anonymizer-selective-field-replacement
opened 04:19PM - 21 Jan 26 UTC
Follow-up to 1fd17242d1.
The previous implementation replaced all four UserHi…story fields (context, details, previous_value, new_value) whenever any one of them contained the username. This caused confusing output in the staff action logs UI - for example, a "check email" action that only had the username in the context field would display:
New: [removed due to user anonymization]
Previous: [removed due to user anonymization]
[removed due to user anonymization]
...even though those fields were originally empty.
Now each field is updated independently using SQL CASE expressions, so only fields that actually contain the username get replaced. Fields with unrelated content or nil values are preserved. This keeps the anonymization effective while avoiding the cluttered display.
Ref - https://meta.discourse.org/t/-/387500