# 更改 Enable 表单模板的目标受众会在左侧边栏中错误地创建一个“更新 Discourse”选项

**URL:** <https://meta.discourse.org/t/changing-the-target-audience-of-enable-form-templates-incorrectly-creates-an-update-discourse-option-in-the-left-sidebar/398151>\
**Category:** Bug\
**Tags:** fixed\
**Created:** [2026年三月11日 11:32 UTC](https://meta.discourse.org/t/changing-the-target-audience-of-enable-form-templates-incorrectly-creates-an-update-discourse-option-in-the-left-sidebar/398151 "2026-03-11T11:32:57Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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年三月24日 15:39 UTC](https://meta.discourse.org/t/changing-the-target-audience-of-enable-form-templates-incorrectly-creates-an-update-discourse-option-in-the-left-sidebar/398151/2 "2026-03-24T15:39:41Z")

</div>

感谢您的报告 @Noble_Fish 👍

@martin 您对这个修复有什么看法？

> <https://github.com/discourse/discourse/pull/38828>
>
> The admin sidebar's \`@cached\` \`sections\` getter calls \`amendLinksToSection\` on \`…AdminNavManager\`, which permanently mutates its internal \`#adminNavMap\`. When the getter re-evaluates (e.g. after toggling the \`enable\_form\_templates\` upcoming change via MessageBus), links accumulate: they persist after a setting is turned off and duplicate on repeated toggles.
> 
> This happens because \`amendLinksToSection\` pushes to the persistent \`#adminNavMap\` array, and there was no mechanism to reset it between evaluations.
> 
> The fix adds a \`resetNavMap()\` method to \`AdminNavManager\` and calls it at the start of each \`sections\` evaluation, ensuring a clean slate. This also makes the existing dedup guards (plugin link filtering, \`linkExists\` check for upcoming\_changes) redundant, so they are removed along with an unnecessary closure wrapper for login route links.
> 
> https://meta.discourse.org/t/398151

---

_[View the full topic](https://meta.discourse.org/t/changing-the-target-audience-of-enable-form-templates-incorrectly-creates-an-update-discourse-option-in-the-left-sidebar/398151)._
