mirror of
https://github.com/strapi/strapi.git
synced 2025-12-24 13:43:41 +00:00
fix: hide the locale option in the Edit view dropdown if you don't have permission to read it (#22229)
* fix: hide the locale option in the edit view if you don't have permission * fix: change the permission condition * fix: show the option if you have read permission
This commit is contained in:
parent
3827154d28
commit
c196a9d2b8
@ -168,12 +168,20 @@ const LocalePickerAction = ({
|
||||
return null;
|
||||
}
|
||||
|
||||
const displayedLocales = locales.filter((locale) => {
|
||||
/**
|
||||
* If you can read we allow you to see the locale exists
|
||||
* otherwise the locale is hidden.
|
||||
*/
|
||||
return canRead.includes(locale.code);
|
||||
});
|
||||
|
||||
return {
|
||||
label: formatMessage({
|
||||
id: getTranslation('Settings.locales.modal.locales.label'),
|
||||
defaultMessage: 'Locales',
|
||||
}),
|
||||
options: locales.map((locale) => {
|
||||
options: displayedLocales.map((locale) => {
|
||||
const entryWithLocaleExists = allCurrentLocales.some((doc) => doc.locale === locale.code);
|
||||
|
||||
const currentLocaleDoc = allCurrentLocales.find((doc) =>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user