# 聊天邮件偏好设置坏了吗？

**URL:** https://meta.discourse.org/t/chat-email-preferences-broken/391509
**Category:** Bug
**Tags:** chat
**Created:** [2025年十二月16日 23:22 UTC](https://meta.discourse.org/t/chat-email-preferences-broken/391509 "2025-12-16T23:22:55Z")
**Posts on this page:** 1
**Showing post:** 9

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [2025年十二月18日 17:23 UTC](https://meta.discourse.org/t/chat-email-preferences-broken/391509/9 "2025-12-18T17:23:19Z")

</div>

我成功禁用了测试用户在我论坛上关于聊天消息的电子邮件通知 🥳  
这可能是在

> <https://github.com/discourse/discourse/pull/36757>
>
> Previously, plugins that needed to save user preferences on specific preference …pages had to either:
> 
> 1. Manually register value transformers for \`preferences-save-attributes\`
> 2. Use \`modifyClass\` to push fields to \`saveAttrNames\`
> 
> The second approach was broken because \`saveAttrNames\` is now a getter that returns a fresh array each time, so pushed values were lost.
> 
> This commit introduces three new plugin APIs that handle the transformer registration automatically:
> 
> \- \`addSaveableUserOption(name, { page })\` - for \`user\_options\` table fields
> \- \`addSaveableUserField(name, { page })\` - for \`user\_fields\` table fields
> \- \`addSaveableCustomFields(page)\` - ensures \`custom\_fields\` object is saved on a page (auto-deduplicates across plugins)
> 
> The \`{ page }\` option specifies which preferences page triggers saving: "account", "emails", "interface", "notifications", "profile", "tracking", etc.
> 
> Also updates bundled plugins to use the new APIs:
> \- chat: \`addSaveableUserOption\` with \`{ page: "emails" }\` for email frequency
> \- discourse-ai: \`addSaveableUserOption\` with \`{ page: "interface" }\`
> \- discourse-assign: \`addSaveableUserOption\` with \`{ page: "tracking" }\`, \`addSaveableCustomFields\` with \`"notifications"\`
> \- discourse-policy: \`addSaveableUserOption\` with \`{ page: "emails" }\`
> \- discourse-rewind: \`addSaveableUserOption\` (no page, custom prefs page)
> 
> Deprecates \`addSaveableUserOptionField\` in favor of \`addSaveableUserOption\`.
> 
> Ref - https://meta.discourse.org/t/391509
> 
> Follow up to ee1a1c7219fea70215300c9bf81ce215a09ce17b

中修复的

---

_[View the full topic](https://meta.discourse.org/t/chat-email-preferences-broken/391509)._
