如何重新生成常见问题解答和条款服务页面?

Hi everyone,

I may have deleted FAQ and TOS pages by mistake and I now have a spinning wheel when I click on the FAQ link on the hamburger menu, and “topic not found” for the TOS.

Should I just create these topics? Will they have the same link?
Is there a command to re-build these core files?

Thank you.

有意思。你是怎么删掉这些主题的?在用户界面中,你本不应该被允许删除它们。

首先,让我们确认这些主题是否真的被删除了。

./launcher enter app
rails c
Topic.with_deleted.exists?(SiteSetting.guidelines_topic_id)
Topic.with_deleted.exists?(SiteSetting.tos_topic_id)

如果主题确实已被删除,请在“工作人员”类别中创建两个新主题,并在 Rails 控制台中将主题 ID 分配给相应的站点设置。

SiteSetting.guidelines_topic_id = 4711 # 替换为实际的主题 ID
SiteSetting.tos_topic_id = 4712 # 替换为实际的主题 ID

SiteSetting.default_locale

然后,按照 Update seeded categories and topics 中描述的“手动更新”方法,替换这些主题的内容。

Thank you so much @gerhard. Very helpful as always.
As soon as I get at a computer I’ll check this out.

We had a failed migration and wanted to keep discourse settings while deleting the migrated topics/categories. And because we had a “trash” folder with about 70k topics of trash, all written by “system”, we had to forcefully clear from the DB all topics created.

Is this the command for the “/privacy” page?

SiteSetting.privacy_topic_id = 4712 # replace with topic id

Thank you.

Yes, that’s the correct site setting.

[1] pry(main)> **Topic** .with_deleted.exists?( **SiteSetting** .guidelines_topic_id)
=> **false**
[2] pry(main)> **Topic** .with_deleted.exists?( **SiteSetting** .tos_topic_id)
=> **false**
[3] pry(main)>

They were indeed missing as suspected.

Thank you so much. It worked like a charm.