# 我难以恢复已删除的帖子，该如何修复？

**URL:** <https://meta.discourse.org/t/im-struggling-to-recover-deleted-post-how-to-fix/403161>\
**Category:** Bug\
**Tags:** nested-replies\
**Created:** [2026年五月16日 16:09 UTC](https://meta.discourse.org/t/im-struggling-to-recover-deleted-post-how-to-fix/403161 "2026-05-16T16:09:08Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prempavee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/prempavee/32/554302_2.png) [@Prempavee](https://meta.discourse.org/u/Prempavee)\
**Post date:** [2026年五月16日 16:09 UTC](https://meta.discourse.org/t/im-struggling-to-recover-deleted-post-how-to-fix/403161/1 "2026-05-16T16:09:08Z")

</div>

![Screenshot 2026-05-16 230643](https://global.discourse-cdn.com/meta/original/4X/0/8/d/08d4758064fb18d498fc6cf2580e4b6e13b95900.png) 没有提供任何选项，所以我尝试从日志中查找，但似乎不可能

 ![Screenshot 2026-05-16 230807](https://global.discourse-cdn.com/meta/original/4X/a/0/a/a0a030ae1ce231bf4f66b81859603a952506a27b.png)

 ![Screenshot 2026-05-16 230820](https://global.discourse-cdn.com/meta/original/4X/c/f/1/cf1abfbf8d780f5f961cdb87936c7863185b15a5.png)

---

<div class="post-metadata">

**Author:** ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)\
**Post date:** [2026年五月16日 16:33 UTC](https://meta.discourse.org/t/im-struggling-to-recover-deleted-post-how-to-fix/403161/2 "2026-05-16T16:33:25Z")

</div>

请使用管理员扳手，而不是批量操作

 ![IMG5286](https://global.discourse-cdn.com/meta/original/4X/9/c/b/9cbdaf9b7f3c35613bac808d77b34dcd8ecb307b.jpeg)

---

<div class="post-metadata">

**Author:** ![Prempavee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/prempavee/32/554302_2.png) [@Prempavee](https://meta.discourse.org/u/Prempavee)\
**Post date:** [2026年五月16日 17:14 UTC](https://meta.discourse.org/t/im-struggling-to-recover-deleted-post-how-to-fix/403161/3 "2026-05-16T17:14:28Z")

</div>

这是哪里，我找不到

---

<div class="post-metadata">

**Author:** ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)\
**Post date:** [2026年五月16日 17:15 UTC](https://meta.discourse.org/t/im-struggling-to-recover-deleted-post-how-to-fix/403161/4 "2026-05-16T17:15:39Z")

</div>

如果您在时间线旁边没有看到它，请转到主题底部，那里有页脚按钮。

 ![Screenshot 2026-05-16 at 10.16.50 AM](https://global.discourse-cdn.com/meta/original/4X/5/c/e/5cef996149d6a8ce4b552588fb2c8a42f7361a51.png)

 ![Screenshot 2026-05-16 at 10.16.12 AM](https://global.discourse-cdn.com/meta/original/4X/e/9/1/e91ecde24c379a7b3ce18a7a0f351b8839001ab1.png)

---

<div class="post-metadata">

**Author:** ![Prempavee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/prempavee/32/554302_2.png) [@Prempavee](https://meta.discourse.org/u/Prempavee)\
**Post date:** [2026年五月16日 17:17 UTC](https://meta.discourse.org/t/im-struggling-to-recover-deleted-post-how-to-fix/403161/5 "2026-05-16T17:17:50Z")

</div>

> [@Lilly](#):
>
> 如果你没在时间线旁边看到它，请滚动到帖子底部，那里有页脚按钮。

问题在于它不允许我打开该主题。

---

<div class="post-metadata">

**Author:** ![Prempavee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/prempavee/32/554302_2.png) [@Prempavee](https://meta.discourse.org/u/Prempavee)\
**Post date:** [2026年五月16日 17:18 UTC](https://meta.discourse.org/t/im-struggling-to-recover-deleted-post-how-to-fix/403161/6 "2026-05-16T17:18:17Z")

</div>

它给了我一个 500 错误

---

<div class="post-metadata">

**Author:** ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)\
**Post date:** [2026年五月16日 17:18 UTC](https://meta.discourse.org/t/im-struggling-to-recover-deleted-post-how-to-fix/403161/7 "2026-05-16T17:18:40Z")

</div>

请在发帖求助时提供更多详细信息。

> [@Prempavee](#):
>
> 它给了我 500 错误

请联系你的管理员。

---

<div class="post-metadata">

**Author:** ![Prempavee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/prempavee/32/554302_2.png) [@Prempavee](https://meta.discourse.org/u/Prempavee)\
**Post date:** [2026年五月16日 17:19 UTC](https://meta.discourse.org/t/im-struggling-to-recover-deleted-post-how-to-fix/403161/8 "2026-05-16T17:19:58Z")

</div>

我是管理员

（给 20 添加字母）

---

<div class="post-metadata">

**Author:** ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)\
**Post date:** [2026年五月16日 17:20 UTC](https://meta.discourse.org/t/im-struggling-to-recover-deleted-post-how-to-fix/403161/9 "2026-05-16T17:20:28Z")

</div>

安全模式下会发生什么？控制台有报错吗？

---

<div class="post-metadata">

**Author:** ![Prempavee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/prempavee/32/554302_2.png) [@Prempavee](https://meta.discourse.org/u/Prempavee)\
**Post date:** [2026年五月16日 17:24 UTC](https://meta.discourse.org/t/im-struggling-to-recover-deleted-post-how-to-fix/403161/10 "2026-05-16T17:24:09Z")

</div>

相同

1234567890-1234567890

---

<div class="post-metadata">

**Author:** ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)\
**Post date:** [2026年五月16日 17:25 UTC](https://meta.discourse.org/t/im-struggling-to-recover-deleted-post-how-to-fix/403161/11 "2026-05-16T17:25:17Z")

</div>

> [@Prempavee](#):
>
> 1234567890-1234567890

那么控制台有报错吗？

---

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [2026年五月16日 17:31 UTC](https://meta.discourse.org/t/im-struggling-to-recover-deleted-post-how-to-fix/403161/12 "2026-05-16T17:31:20Z")

</div>

这似乎是在尝试访问已删除的嵌套主题时出现的错误。我可以在周一查看一下。

---

<div class="post-metadata">

**Author:** ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)\
**Post date:** [2026年五月16日 17:31 UTC](https://meta.discourse.org/t/im-struggling-to-recover-deleted-post-how-to-fix/403161/13 "2026-05-16T17:31:24Z")

</div>

哦，等等，我知道那个论坛。我敢打赌这是一个嵌套主题的帖子。

---

<div class="post-metadata">

**Author:** ![Prempavee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/prempavee/32/554302_2.png) [@Prempavee](https://meta.discourse.org/u/Prempavee)\
**Post date:** [2026年五月16日 17:34 UTC](https://meta.discourse.org/t/im-struggling-to-recover-deleted-post-how-to-fix/403161/15 "2026-05-16T17:34:16Z")

</div>

不，这只是我在输入数字，因为回复不能少于20个字母。

---

<div class="post-metadata">

**Author:** ![Prempavee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/prempavee/32/554302_2.png) [@Prempavee](https://meta.discourse.org/u/Prempavee)\
**Post date:** [2026年五月16日 17:34 UTC](https://meta.discourse.org/t/im-struggling-to-recover-deleted-post-how-to-fix/403161/16 "2026-05-16T17:34:39Z")

</div>

谢谢，这将会非常有用。

---

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [2026年五月18日 18:37 UTC](https://meta.discourse.org/t/im-struggling-to-recover-deleted-post-how-to-fix/403161/17 "2026-05-18T18:37:57Z")

</div>

> <https://github.com/discourse/discourse/pull/40134>
>
> \## Summary
> 
> \`NestedReplies::TreeLoader#op\_post\` loaded the OP via \`topic.posts\`,… whose default scope (from \`Trashable\`) excludes rows with \`deleted\_at\` set. When a topic is trashed its OP is trashed too, so the lookup returned \`nil\` and the \`/n/...\` request crashed in \`PostPreloader#prepare\` with \`undefined method 'user\_id' for nil\` — preventing staff from reaching the page to recover the topic.
> 
> Fix: apply the existing visibility helper (which already unscopes \`deleted\_at\`) on the OP query. The serializer's \`deleted\_post\_placeholder\` path preserves content for staff and hides it for everyone else, matching the flat topic view.
> 
> \- non-staff still 404 via the earlier guardian check on the topic itself, so this does not change their visibility
> \- both the \`show\` and \`context\` endpoints share the same loader, so both paths are fixed
> 
> \## Test plan
> 
> \- \[x\] \`bin/rspec spec/requests/nested\_topics\_controller\_spec.rb\` (100 examples, 0 failures), with new cases for staff \`show\`, staff \`context\`, and non-staff 404 on a fully-deleted topic
> \- \[x\] \`bin/rspec spec/lib/nested\_replies/ spec/services/nested\_topic/\` (127 examples, 0 failures)
> \- \[\] Manually: as admin, delete a topic that uses nested replies, then navigate to \`/n/\<slug\>/\<id\>\` — page renders with the deleted OP placeholder and the admin menu's Recover Topic action works

---

<div class="post-metadata">

**Author:** ![Prempavee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/prempavee/32/554302_2.png) [@Prempavee](https://meta.discourse.org/u/Prempavee)\
**Post date:** [2026年五月18日 18:45 UTC](https://meta.discourse.org/t/im-struggling-to-recover-deleted-post-how-to-fix/403161/18 "2026-05-18T18:45:01Z")

</div>

Falco，为什么我点击主题时，它们总是从底部打开？

---

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [2026年五月18日 18:46 UTC](https://meta.discourse.org/t/im-struggling-to-recover-deleted-post-how-to-fix/403161/19 "2026-05-18T18:46:14Z")

</div>

它会在你最后阅读的帖子处打开话题。这是 Discourse 的运行方式。你可以访问一些 Discourse 网站，并在此使用搜索功能，以熟悉该软件。

---

<div class="post-metadata">

**Author:** ![Prempavee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/prempavee/32/554302_2.png) [@Prempavee](https://meta.discourse.org/u/Prempavee)\
**Post date:** [2026年五月18日 18:47 UTC](https://meta.discourse.org/t/im-struggling-to-recover-deleted-post-how-to-fix/403161/20 "2026-05-18T18:47:35Z")

</div>

我试过了，但它的表现不同

---

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [2026年六月17日 20:54 UTC](https://meta.discourse.org/t/im-struggling-to-recover-deleted-post-how-to-fix/403161/21 "2026-06-17T20:54:00Z")

</div>


