Fix admin editing instance language

Closes #976

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-12-21 19:47:54 +01:00
parent 19bf587dc9
commit 15d186cc25
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773

View file

@ -433,18 +433,22 @@ export default class Settings extends Vue {
RouteName = RouteName;
get instanceLanguages(): string[] {
const languageCodes = this.adminSettings.instanceLanguages || [];
const languageCodes = [...this.adminSettings.instanceLanguages] || [];
return languageCodes
.map((code) => this.languageForCode(code))
.filter((language) => language) as string[];
}
set instanceLanguages(instanceLanguages: string[]) {
this.adminSettings.instanceLanguages = instanceLanguages
const newInstanceLanguages = instanceLanguages
.map((language) => {
return this.codeForLanguage(language);
})
.filter((code) => code !== undefined) as string[];
this.adminSettings = {
...this.adminSettings,
instanceLanguages: newInstanceLanguages,
};
}
async updateSettings(): Promise<void> {