Skip to content

Conversation

@ZogStriP
Copy link
Member

Follow-up to 1fd1724.

The previous implementation replaced all four UserHistory 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

Follow-up to 1fd1724.

The previous implementation replaced all four UserHistory 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
@discoursebot
Copy link

This pull request has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/log-anonymizer-details-setting-not-fully-anonymizing-usernames/387500/8

@ZogStriP ZogStriP merged commit 7a15be0 into main Jan 27, 2026
16 checks passed
@ZogStriP ZogStriP deleted the fix/anonymizer-selective-field-replacement branch January 27, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants