# \`日志匿名器详细信息\`设置未完全匿名用户名

**URL:** https://meta.discourse.org/t/log-anonymizer-details-setting-not-fully-anonymizing-usernames/387500
**Category:** Bug
**Tags:** anonymization
**Created:** [2025年十一月3日 21:35 UTC](https://meta.discourse.org/t/log-anonymizer-details-setting-not-fully-anonymizing-usernames/387500 "2025-11-03T21:35:46Z")
**Posts on this page:** 1
**Showing post:** 8

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2026年一月21日 16:21 UTC](https://meta.discourse.org/t/log-anonymizer-details-setting-not-fully-anonymizing-usernames/387500/8 "2026-01-21T16:21:16Z")

</div>

@Moin 意识到我在更新时太松懈了 🤦‍♂️

> <https://github.com/discourse/discourse/pull/37242>
>
> 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

---

_[View the full topic](https://meta.discourse.org/t/log-anonymizer-details-setting-not-fully-anonymizing-usernames/387500)._
