FIX: small bug with topics and my posts translations (#22179)

1. `everything` was changed to `topics`
2. Path for my posts translation is `sidebar.sections.community.links.my_posts.content` not `sidebar.sections.community.links.my/posts.content`
This commit is contained in:
Krzysztof Kotlarek 2023-06-19 17:51:33 +10:00 committed by GitHub
parent cbb9396353
commit 8837ee4b39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 2 deletions

View File

@ -40,7 +40,7 @@ export default class EverythingSectionLink extends BaseSectionLink {
} }
get title() { get title() {
return I18n.t("sidebar.sections.community.links.everything.title"); return I18n.t("sidebar.sections.community.links.topics.title");
} }
get text() { get text() {

View File

@ -74,7 +74,7 @@ export default class MyPostsSectionLink extends BaseSectionLink {
return I18n.t( return I18n.t(
`sidebar.sections.community.links.${this.overridenName `sidebar.sections.community.links.${this.overridenName
.toLowerCase() .toLowerCase()
.replace(" ", "/")}.content`, .replace(" ", "_")}.content`,
{ defaultValue: this.overridenName } { defaultValue: this.overridenName }
); );
} }

View File

@ -89,4 +89,32 @@ describe "Viewing sidebar", type: :system do
expect(header_dropdown).to be_visible expect(header_dropdown).to be_visible
end end
end end
describe "Community sidebar section", type: :system do
fab!(:user) { Fabricate(:user, locale: "pl_PL") }
fab!(:translation_override) do
TranslationOverride.create!(
locale: "pl_PL",
translation_key: "js.sidebar.sections.community.links.topics.content",
value: "Tematy",
)
TranslationOverride.create!(
locale: "pl_PL",
translation_key: "js.sidebar.sections.community.links.topics.title",
value: "Wszystkie tematy",
)
end
before { SiteSetting.allow_user_locale = true }
it "has correct translations" do
sign_in user
visit("/latest")
links = page.all("#sidebar-section-content-community .sidebar-section-link-wrapper a")
expect(links.map(&:text)).to eq(%w[Tematy Wysłane])
expect(links.map { |link| link[:title] }).to eq(
["Wszystkie tematy", "Moja ostatnia aktywność w temacie"],
)
end
end
end end