[user] quick fix for customFlags array/object issue

This commit is contained in:
Andrea Vos 2022-10-02 09:29:22 +02:00
parent 71b552bf49
commit 68385f92e8

View File

@ -271,6 +271,10 @@
return words; return words;
} }
function fixArrayObject(arrayObject) {
return Array.isArray(arrayObject) ? arrayObject : Object.values(arrayObject);
}
const buildProfile = (profiles, currentLocale) => { const buildProfile = (profiles, currentLocale) => {
for (let locale in profiles) { for (let locale in profiles) {
if (!profiles.hasOwnProperty(locale)) { if (!profiles.hasOwnProperty(locale)) {
@ -285,7 +289,7 @@
birthday: profile.birthday, birthday: profile.birthday,
links: profile.links, links: profile.links,
flags: profile.flags, flags: profile.flags,
customFlags: profile.customFlags, customFlags: fixArrayObject(profile.customFlags),
words: coerceWords(profile.words), words: coerceWords(profile.words),
teamName: profile.teamName, teamName: profile.teamName,
footerName: profile.footerName, footerName: profile.footerName,
@ -309,7 +313,7 @@
birthday: profile.birthday, birthday: profile.birthday,
links: profile.links, links: profile.links,
flags: profile.flags.filter(f => !f.startsWith('-')), flags: profile.flags.filter(f => !f.startsWith('-')),
customFlags: profile.customFlags, customFlags: fixArrayObject(profile.customFlags),
words: [...defaultWords], words: [...defaultWords],
teamName: profile.teamName, teamName: profile.teamName,
footerName: profile.footerName, footerName: profile.footerName,
@ -327,7 +331,7 @@
birthday: null, birthday: null,
links: [], links: [],
flags: [], flags: [],
customFlags: {}, customFlags: [],
words: [...defaultWords], words: [...defaultWords],
teamName: '', teamName: '',
footerName: '', footerName: '',
@ -385,7 +389,7 @@
birthday: formatDate(this.birthday), birthday: formatDate(this.birthday),
links: [...this.links], links: [...this.links],
flags: [...this.flags], flags: [...this.flags],
customFlags: {...this.customFlags}, customFlags: [...fixArrayObject(this.customFlags)],
words: this.words, words: this.words,
teamName: this.teamName, teamName: this.teamName,