# 无法从标题中固定/取消固定主题

**URL:** <https://meta.discourse.org/t/cant-pin-unpin-topic-from-the-title/213444>\
**Category:** Bug\
**Created:** [2021年十二月30日 11:50 UTC](https://meta.discourse.org/t/cant-pin-unpin-topic-from-the-title/213444 "2021-12-30T11:50:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ondrej](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ondrej/32/198804_2.png) [@ondrej](https://meta.discourse.org/u/ondrej)\
**Post date:** [2021年十二月30日 11:50 UTC](https://meta.discourse.org/t/cant-pin-unpin-topic-from-the-title/213444/1 "2021-12-30T11:50:09Z")

</div>

之前（我99%确定）如果一个主题被置顶，当你向下滚动时，标题会出现在页眉中（正如你在图1中看到的），你可以点击 📌 图标来置顶/取消置顶。然而，尽管图钉仍然可以点击，但它不允许你这样做。在图2中，它工作正常，你可以置顶/取消置顶。

1. ![Header](https://global.discourse-cdn.com/meta/original/3X/f/7/f72e1fdb9473c27985b3d6ba34a009a73a0ba7c4.png)

* * *

1. ![Title](https://global.discourse-cdn.com/meta/original/3X/c/d/cd5e5172f33cdab63fcdd4643371d4fb9887823f.png)

* * *

这发生在最新版本的 Discourse 上，并且影响桌面和移动设备。我使用的是 Chrome。

---

<div class="post-metadata">

**Author:** ![Benjamin\_D](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/benjamin_d/32/277831_2.png) [@Benjamin\_D](https://meta.discourse.org/u/Benjamin_D)\
**Post date:** [2021年十二月30日 12:25 UTC](https://meta.discourse.org/t/cant-pin-unpin-topic-from-the-title/213444/2 "2021-12-30T12:25:40Z")

</div>

我同意，Firefox，最新版本 2.8.0.beta10（[bbca25e875](https://github.com/discourse/discourse/commits/bbca25e875c36d3541b22c520b6d56ae6322dfbe)），即使在安全模式下，控制台中也没有任何内容。（不确定之前是否也是这样）

---

<div class="post-metadata">

**Author:** ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)\
**Post date:** [2021年十二月30日 12:32 UTC](https://meta.discourse.org/t/cant-pin-unpin-topic-from-the-title/213444/3 "2021-12-30T12:32:39Z")

</div>

我也无法从标题栏固定/取消固定（尽管我认为我这是第一次尝试🙂）。

我在元站点、我的测试站点（[最新](https://github.com/discourse/discourse/commits/bbca25e875c36d3541b22c520b6d56ae6322dfbe)）、我的在线站点（[不是最新](https://github.com/discourse/discourse/commits/312c4173664734b803c7332015de6ceb6f5d5e62)）以及我参与的另一个 Discourse 托管论坛（[又旧了一点](https://github.com/discourse/discourse/commits/10caceec42f529c8797e6e5010ec2e319cb272c0)）上进行了测试。

Android/Chrome

---

<div class="post-metadata">

**Author:** ![Osama](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/osama/32/98013_2.png) [@Osama](https://meta.discourse.org/u/Osama)\
**Post date:** [2022年一月3日 13:02 UTC](https://meta.discourse.org/t/cant-pin-unpin-topic-from-the-title/213444/6 "2022-01-03T13:02:34Z")

</div>

> <https://github.com/discourse/discourse/commit/61bb0df3f638963e331af4c4722216695ad6b295>
>
> Meta topic: https://meta.discourse.org/t/cant-pin-unpin-topic-from-the-title/213…444?u=osama.
> 
> I know there is an inconsistency between the category of the linked topic (#bug) and the title prefix of this PR, but I really couldn't find anything in the code base that suggested this ever worked before, so I'm categorizing this PR as a feature.

我将提交的标题加上了 `FEATURE` 前缀，因为我在代码库中找不到任何表明这之前是有效的迹象，所以唯一“修复”它的方法就是添加支持，这意味着这是一项新功能 😃

我还注意到，由于一个主题组件，在 Meta 上切换主题列表中的固定按钮无法正常工作，所以我对此也进行了修复：

> <https://github.com/discourse/discourse-topic-thumbnails/pull/13>
>
> This component overrides core's method \`renderTopicListItem\` which has an \`@obse…rves\` decorator for \`topic.pinned\` so that the UI updates when the user toggles the pin for a topic in a topics list. However, the method override in this component doesn't apply the same decorator to the override which effectively removes the decorator entirely and that causes the UI not to update when the pin is toggled.
> 
> https://github.com/discourse/discourse/blob/810e040f170813fdff9727bf6e145824ad6f14eb/app/assets/javascripts/discourse/app/components/topic-list-item.js#L49-L53
> 
> Related meta topic: https://meta.discourse.org/t/cant-pin-unpin-topic-from-the-title/213444?u=osama.

---

<div class="post-metadata">

**Author:** ![ondrej](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ondrej/32/198804_2.png) [@ondrej](https://meta.discourse.org/u/ondrej)\
**Post date:** [2022年一月3日 13:39 UTC](https://meta.discourse.org/t/cant-pin-unpin-topic-from-the-title/213444/7 "2022-01-03T13:39:08Z")

</div>

太棒了！谢谢你 ❤

---

<div class="post-metadata">

**Author:** ![Osama](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/osama/32/98013_2.png) [@Osama](https://meta.discourse.org/u/Osama)\
**Post date:** [2022年一月13日 07:21 UTC](https://meta.discourse.org/t/cant-pin-unpin-topic-from-the-title/213444/8 "2022-01-13T07:21:47Z")

</div>


