Fix language settings bug (#1091)

This commit is contained in:
LautaroCesso 2021-11-24 15:17:38 -03:00 committed by GitHub
parent 9715cdc9a1
commit 84f36e89dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -126,13 +126,14 @@ class AdminPanelSystemPreferences extends React.Component {
onFormChange(form) { onFormChange(form) {
const { language, supportedLanguages, allowedLanguages } = form; const { language, supportedLanguages, allowedLanguages } = form;
const languageIndex = _.indexOf(languageKeys, language); const languageIndex = _.indexOf(languageKeys, language);
const updatedSupportedLanguages = _.filter(supportedLanguages, (supportedIndex) => _.includes(allowedLanguages, supportedIndex));
this.setState({ this.setState({
values: _.extend({}, form, { values: _.extend({}, form, {
language: _.includes(supportedLanguages, languageIndex) ? language : languageKeys[supportedLanguages[0]], language: _.includes(updatedSupportedLanguages, languageIndex) ? language : languageKeys[updatedSupportedLanguages[0]],
supportedLanguages: _.filter(supportedLanguages, (supportedIndex) => _.includes(allowedLanguages, supportedIndex)) supportedLanguages: updatedSupportedLanguages
}), }),
message: null message: null
}); });
} }