FIX: missing translation of guidelines_topic.body (#25505)

Broken in https://github.com/discourse/discourse/pull/25253
This commit is contained in:
Neil Lalonde 2024-01-31 15:33:09 -05:00 committed by GitHub
parent bfa3e056f1
commit ba68ee4da7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 6 deletions

View File

@ -4506,7 +4506,7 @@ en:
## [Powered by You](#power) ## [Powered by You](#power)
This site is operated by your [friendly local staff](%{base_path}/about) and *you*, the community. If you have any further questions about how things should work here, open a new topic in %{feedback_category} and lets discuss! If theres a critical or urgent issue that cant be handled by a meta topic or flag, contact us via the [staff page](%{base_path}/about). This site is operated by your [friendly local staff](%{base_path}/about) and *you*, the community. If you have any further questions about how things should work here, open a new topic in %{feedback_category_hashtag} and lets discuss! If theres a critical or urgent issue that cant be handled by a meta topic or flag, contact us via the [staff page](%{base_path}/about).
<a name="tos"></a> <a name="tos"></a>

View File

@ -53,6 +53,9 @@ module SeedData
def topics(site_setting_names: nil, include_welcome_topics: true, include_legal_topics: true) def topics(site_setting_names: nil, include_welcome_topics: true, include_legal_topics: true)
staff_category = Category.find_by(id: SiteSetting.staff_category_id) staff_category = Category.find_by(id: SiteSetting.staff_category_id)
feedback_category = Category.find_by(id: SiteSetting.meta_category_id)
feedback_category_hashtag =
feedback_category ? "##{feedback_category.slug}" : "#site-feedback"
topics = [] topics = []
@ -79,7 +82,12 @@ module SeedData
topics << { topics << {
site_setting_name: "guidelines_topic_id", site_setting_name: "guidelines_topic_id",
title: I18n.t("guidelines_topic.title"), title: I18n.t("guidelines_topic.title"),
raw: I18n.t("guidelines_topic.body", base_path: Discourse.base_path), raw:
I18n.t(
"guidelines_topic.body",
base_path: Discourse.base_path,
feedback_category_hashtag: feedback_category_hashtag,
),
category: staff_category, category: staff_category,
static_first_reply: true, static_first_reply: true,
} }
@ -109,10 +117,6 @@ module SeedData
"" ""
end end
feedback_category = Category.find_by(id: SiteSetting.meta_category_id)
feedback_category_hashtag =
feedback_category ? "##{feedback_category.slug}" : "#site-feedback"
topics << { topics << {
site_setting_name: "welcome_topic_id", site_setting_name: "welcome_topic_id",
title: I18n.t("discourse_welcome_topic.title", site_title: SiteSetting.title), title: I18n.t("discourse_welcome_topic.title", site_title: SiteSetting.title),

View File

@ -110,6 +110,18 @@ RSpec.describe SeedData::Topics do
expect(SiteSetting.tos_topic_id).to_not eq(-1) expect(SiteSetting.tos_topic_id).to_not eq(-1)
end end
it "creates FAQ topic" do
meta_category = Fabricate(:category, name: "Meta")
staff_category = Fabricate(:category, name: "Feedback")
SiteSetting.meta_category_id = meta_category.id
SiteSetting.staff_category_id = staff_category.id
create_topic("guidelines_topic_id")
topic = Topic.find(SiteSetting.guidelines_topic_id)
post = Post.find_by(topic_id: SiteSetting.guidelines_topic_id, post_number: 1)
expect(topic.title).to_not include("Translation missing")
expect(post.raw).to_not include("Translation missing")
end
end end
describe "#update" do describe "#update" do