# 合并的主题不再被顶起

**URL:** <https://meta.discourse.org/t/merged-topics-are-no-longer-being-bumped/386078>\
**Category:** Bug\
**Created:** [2025年十月18日 13:10 UTC](https://meta.discourse.org/t/merged-topics-are-no-longer-being-bumped/386078 "2025-10-18T13:10:16Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Richie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/richie/32/115110_2.png) [@Richie](https://meta.discourse.org/u/Richie)\
**Post date:** [2025年十月18日 13:10 UTC](https://meta.discourse.org/t/merged-topics-are-no-longer-being-bumped/386078/1 "2025-10-18T13:10:16Z")

</div>

似乎有一个 bug 潜入了 3.6.0.beta2-latest ([e2eb9fe93f](https://github.com/discourse/discourse/commits/e2eb9fe93f8a338df6981bae0b378f9c9eb57555))，这在我上周进行的更新中并不存在。

如果需要，这是差异：

> **[Comparing...](https://github.com/discourse/discourse/compare/31701bd722b635300511e9743edb40b1133ff866...e2eb9fe93f8a338df6981bae0b378f9c9eb57555)**
>
> A platform for community discussion. Free, open, simple. - Comparing 31701bd722b635300511e9743edb40b1133ff866...e2eb9fe93f8a338df6981bae0b378f9c9eb57555 · discourse/discourse

合并主题时存在一个问题。

以前，我合并进来的主题会被置顶。

现在不再发生这种情况，两个主题都从视野中消失了。

这是我 21 分钟前合并的原始主题：

 ![IMG_0093](https://global.discourse-cdn.com/meta/original/4X/d/8/4/d84650351acb2e17befcecb7bcb65f36752ea39f.png)

转到 `/latest`，可以看到已关闭的主题，但找不到我合并进来的主题 🤷

 ![IMG_0094](https://global.discourse-cdn.com/meta/original/4X/d/c/b/dcbfbea0e44bc7e34837f15657ae602ed47ad8ad.jpeg)

同样，转到 `Travel` 分类，也找不到被置顶的主题 🤷

 ![IMG_0095](https://global.discourse-cdn.com/meta/original/4X/a/0/b/a0b5d1cf7bcdffbe82e2ae272d3bd9f2287e901a.jpeg)

如果我转到我合并进来的主题，然后点击 `Reset Bump Date`，它就会神奇地出现在 `/latest` 中，并带有合并进来的最后一个帖子的正确时间戳。

* * *

如果我合并并勾选“保留时间顺序”框，此问题似乎_不会_发生。

 ![preserve1](https://global.discourse-cdn.com/meta/original/4X/7/d/4/7d4f2cc58a96ba6059f90b3cb98d818c1e65ff26.png)

 ![preserve2](https://global.discourse-cdn.com/meta/original/4X/8/6/6/866770d36080864950336e4a7bf4c15f31c386c8.png)

我已经尝试过使用管理员和版主账户，每次使用这两种账户类型都可以重现此问题。

---

<div class="post-metadata">

**Author:** ![Richie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/richie/32/115110_2.png) [@Richie](https://meta.discourse.org/u/Richie)\
**Post date:** [2025年十月18日 13:12 UTC](https://meta.discourse.org/t/merged-topics-are-no-longer-being-bumped/386078/2 "2025-10-18T13:12:03Z")

</div>

我怀疑这与此有关 🤔

> <https://github.com/discourse/discourse/commit/35fbaebe04e8702a4b1ebcae153385afd24afd8f>
>
> When one of the moved posts was the first post in it's originnal topic,
> it was s…etting the bumped\_at timetamp of the destination post to the
> created\_at timestamp of the moved first post.
> 
> With this fix, instead it leaves the bumped\_at timestamp alone.
> 
> dev /t/164974

---

<div class="post-metadata">

**Author:** ![Richie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/richie/32/115110_2.png) [@Richie](https://meta.discourse.org/u/Richie)\
**Post date:** [2025年十月18日 13:17 UTC](https://meta.discourse.org/t/merged-topics-are-no-longer-being-bumped/386078/3 "2025-10-18T13:17:37Z")

</div>

为了通过场景来阐明此处的问题。

> [@Richie](#):
>
> 这种情况不再发生，两个主题都消失了。

- 用户创建了一个名为“Topic XYZ”的新主题
- 管理员将该新主题合并到一个名为“ABC Topic”的现有主题中  
– 这是为了防止重复主题的标准维护操作
- “Topic XYZ”现在已从公众视野中消失，因为它已被取消列出并合并
- “ABC Topic”在 `/latest`（或其他近期位置）中不可见，因为它没有被置顶
- 没有用户意识到曾经创建了一个新主题/帖子（或者因为合并而技术上成为旧主题的回复），因为它被移动到一个可能已经存在一年的主题中，并且没有被置顶

不确定我是否解释清楚了 😊

---

<div class="post-metadata">

**Author:** ![mcwumbly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcwumbly/32/103861_2.png) [@mcwumbly](https://meta.discourse.org/u/mcwumbly)\
**Post date:** [2025年十月18日 13:40 UTC](https://meta.discourse.org/t/merged-topics-are-no-longer-being-bumped/386078/4 "2025-10-18T13:40:33Z")

</div>

是的，我认为你很好地描述了问题。

@christo 我认为我们需要考虑几种不同的组合：

鉴于我们将主题 A（一个帖子）合并到主题 B，有以下情况需要考虑：

- 
  1. 主题 A 的帖子比主题 B 的最后一个帖子新

  - a. 选择保持时间顺序
  - b. 未选择保持时间顺序

- 
  1. 主题 A 的帖子比主题 B 的最后一个帖子旧

  - c. 选择保持时间顺序
  - d. 未选择保持时间顺序

我认为除了 2(c) 之外，所有情况下的预期行为都是主题被顶起。

在除 2(c) 之外的所有情况下，主题 A 的帖子将附加到主题 B 的末尾，所以我认为合并应该根据合并发生的时间来设置顶起日期。

不过，我不太确定在 2(d) 的情况下，如果管理员稍后执行“重置顶起日期”，会发生什么。我认为它应该将顶起日期更新为主题中最新创建帖子的日期（例如，倒数第二个帖子）。

@martin 你和我一直在考虑其他场景下的顶起日期逻辑——以上对你来说有意义吗？

---

<div class="post-metadata">

**Author:** ![Richie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/richie/32/115110_2.png) [@Richie](https://meta.discourse.org/u/Richie)\
**Post date:** [2025年十月18日 14:05 UTC](https://meta.discourse.org/t/merged-topics-are-no-longer-being-bumped/386078/6 "2025-10-18T14:05:08Z")

</div>

> [@mcwumbly](#):
>
> 我认为预期行为是，除 2(c) 外，所有情况下的主题都会被顶起。

是的，仅根据我本周安装的更新之前的行为一直如此。

同样，我们现在遇到的问题是，新主题/帖子会凭空消失，因为它们不再会顶起它们被合并到的主题——而过去它们一直都会。

> [@mcwumbly](#):
>
> 如果管理员之后执行“重置顶帖日期”。我认为它应该将顶帖日期更新为主题中最新帖子（例如倒数第二个帖子）的日期。

我同意。

---

<div class="post-metadata">

**Author:** ![martin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martin/32/491371_2.png) [@martin](https://meta.discourse.org/u/martin)\
**Post date:** [2025年十月20日 01:43 UTC](https://meta.discourse.org/t/merged-topics-are-no-longer-being-bumped/386078/7 "2025-10-20T01:43:59Z")

</div>

是的，我认为这说得通 👍

---

<div class="post-metadata">

**Author:** ![christo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/christo/32/470948_2.png) [@christo](https://meta.discourse.org/u/christo)\
**Post date:** [2025年十月22日 21:25 UTC](https://meta.discourse.org/t/merged-topics-are-no-longer-being-bumped/386078/8 "2025-10-22T21:25:18Z")

</div>

是的，看起来这是我在上面链接的提交中引入的一个 bug。我本想修复一个问题，即当合并了比目标主题中最新帖子更早的第一个帖子时，`bumped_at` 日期有时会被推迟。但看起来我也破坏了第一个帖子更新的情况。

我正在处理一个修复程序，解决后我会在此更新。

---

<div class="post-metadata">

**Author:** ![christo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/christo/32/470948_2.png) [@christo](https://meta.discourse.org/u/christo)\
**Post date:** [2025年十月23日 16:18 UTC](https://meta.discourse.org/t/merged-topics-are-no-longer-being-bumped/386078/10 "2025-10-23T16:18:30Z")

</div>

这是修复此问题的 PR。一旦获得批准和合并，我会再次更新。

> <https://github.com/discourse/discourse/pull/35559>
>
> Fixes a bug I introduced in #35373. Reported on Meta /t/386078
> 
> The intention …there was to make sure that when merging a first post from one topic which is older than the latest post in the destination topic, we shouldn't bump the destination topic. Previous to that, we were bumping the destination topic to the date of the moved post, which sometimes pushed the bumped\_at timestamp back in time.
> 
> Looks like that also broke the case where the moved first post is more recent than the latest post in the destination topic, because the logic for updating the bumped\_at date based on the most recent merged post (in \`update\_last\_post\_stats\`) wasn't considering moved posts which were the first post of their original topic because the \`id\` of that post has changed.
> 
> This should fix both cases. Now if any post moved (including a first post) is newer than the latest post in the destination topic, the destination topic should be bumped. Post timings should still be respected.
> 
> Adds test cases for chronological and sequential moves of first posts which become the newest post in the destination topic, and updates a test to make sure I didn't break post timings.

---

<div class="post-metadata">

**Author:** ![Richie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/richie/32/115110_2.png) [@Richie](https://meta.discourse.org/u/Richie)\
**Post date:** [2025年十月23日 17:29 UTC](https://meta.discourse.org/t/merged-topics-are-no-longer-being-bumped/386078/11 "2025-10-23T17:29:26Z")

</div>

感谢你的快速修复 @christo 🙇

---

<div class="post-metadata">

**Author:** ![christo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/christo/32/470948_2.png) [@christo](https://meta.discourse.org/u/christo)\
**Post date:** [2025年十月24日 13:59 UTC](https://meta.discourse.org/t/merged-topics-are-no-longer-being-bumped/386078/12 "2025-10-24T13:59:39Z")

</div>

好的，此修复已合并。应该能按预期正常工作了。

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [2025年十月26日 21:51 UTC](https://meta.discourse.org/t/merged-topics-are-no-longer-being-bumped/386078/13 "2025-10-26T21:51:09Z")

</div>


