FIX: Use placeholder for "everyone" group name in category permissions (#37724)

Automatic group names are translated to the forum's default locale (e.g.
"jeder" in German). The category permission warning messages and
inherited permission tooltips were hardcoding the English "everyone"
name, which created a mismatch when the admin UI showed the localized
group name.

Replace the hardcoded "everyone" in the four affected translation
strings with a `%{everyone_group}` placeholder and pass the actual group
name from the permission data at each call site.

https://meta.discourse.org/t/395809
This commit is contained in:
Régis Hanol
2026-02-11 18:23:00 +01:00
committed by GitHub
parent cda705f784
commit c63fc5b53d
6 changed files with 44 additions and 12 deletions
+4 -4
View File
@@ -4665,14 +4665,14 @@ en:
reply: "Reply"
create: "Create"
no_groups_selected: "No groups have been granted access; this category will only be visible to staff."
everyone_full_access: 'This category is public, everyone can see, reply and create posts. To restrict permissions, remove one or more of the permissions granted to the "everyone" group.'
everyone_reply_access: 'This category is public, everyone can see and reply to topics. To restrict permissions, remove the "everyone" group.'
everyone_see_access: 'This category is public, everyone can see posts. To restrict permissions, remove the "everyone" group.'
everyone_full_access: 'This category is public, everyone can see, reply and create posts. To restrict permissions, remove one or more of the permissions granted to the "%{everyone_group}" group.'
everyone_reply_access: 'This category is public, everyone can see and reply to topics. To restrict permissions, remove the "%{everyone_group}" group.'
everyone_see_access: 'This category is public, everyone can see posts. To restrict permissions, remove the "%{everyone_group}" group.'
specific_groups_have_access: "This category is private, only the selected groups can see, reply and create posts."
all_parent_groups_used: "All groups from the parent category have been added. To add more groups, first add them to the parent category."
toggle_reply: "Toggle Reply permission"
toggle_full: "Toggle Create permission"
inherited: 'This permission is inherited from "everyone"'
inherited: 'This permission is inherited from "%{everyone_group}"'
special_warning: "This is a pre-seeded category and the security settings cannot be edited. If you do not wish to use this category, delete it instead of repurposing it."
uncategorized_security_warning: "This category is special. It is intended as holding area for topics that have no category; it cannot have security settings."
uncategorized_general_warning: 'This category is special. It is used as the default category for new topics that do not have a category selected. If you want to prevent this behavior and force category selection, <a href="%{settingLink}">please disable the setting here</a>. If you want to change the name or description, go to <a href="%{customizeLink}">Customize / Text Content</a>.'
@@ -135,7 +135,10 @@ export default class EditCategorySecurity extends buildCategoryPanel(
<@form.Alert @type="warning">
{{#if this.everyoneGrantedFull}}
{{i18n "category.permissions.everyone_full_access"}}
{{i18n
"category.permissions.everyone_full_access"
everyone_group=this.everyonePermission.group_name
}}
{{else}}
{{i18n "category.permissions.specific_groups_have_access"}}
{{/if}}
@@ -53,9 +53,15 @@ export default class UpsertCategoryPermissionRow extends Component {
);
}
get everyoneGroupName() {
return this.args.everyonePermission?.group_name;
}
get replyTooltip() {
return this.replyDisabled
? i18n("category.permissions.inherited")
? i18n("category.permissions.inherited", {
everyone_group: this.everyoneGroupName,
})
: i18n("category.permissions.toggle_reply");
}
@@ -69,7 +75,9 @@ export default class UpsertCategoryPermissionRow extends Component {
get createTooltip() {
return this.createDisabled
? i18n("category.permissions.inherited")
? i18n("category.permissions.inherited", {
everyone_group: this.everyoneGroupName,
})
: i18n("category.permissions.toggle_full");
}
@@ -240,7 +240,10 @@ export default class UpsertCategorySecurity extends Component {
<@form.Alert @type="warning">
{{#if this.everyonePermission}}
{{i18n this.everyoneAccessMessageKey}}
{{i18n
this.everyoneAccessMessageKey
everyone_group=this.everyonePermission.group_name
}}
{{else}}
{{i18n "category.permissions.specific_groups_have_access"}}
{{/if}}
@@ -58,9 +58,15 @@ export default class CategoryPermissionRow extends Component {
return false;
}
get everyoneGroupName() {
return this.args.everyonePermission?.group_name;
}
get replyTooltip() {
return this.replyDisabled
? i18n("category.permissions.inherited")
? i18n("category.permissions.inherited", {
everyone_group: this.everyoneGroupName,
})
: i18n("category.permissions.toggle_reply");
}
@@ -79,7 +85,9 @@ export default class CategoryPermissionRow extends Component {
get createTooltip() {
return this.createDisabled
? i18n("category.permissions.inherited")
? i18n("category.permissions.inherited", {
everyone_group: this.everyoneGroupName,
})
: i18n("category.permissions.toggle_full");
}
+12 -2
View File
@@ -145,11 +145,21 @@ module PageObjects
end
def has_public_access_message?
page.has_content?(I18n.t("js.category.permissions.everyone_full_access"))
page.has_content?(
I18n.t(
"js.category.permissions.everyone_full_access",
everyone_group: ::Group[:everyone].name,
),
)
end
def has_no_public_access_message?
page.has_no_content?(I18n.t("js.category.permissions.everyone_full_access"))
page.has_no_content?(
I18n.t(
"js.category.permissions.everyone_full_access",
everyone_group: ::Group[:everyone].name,
),
)
end
def has_setting_tab?(tab_name)