From 68385f92e838f26b9ede5f876e74ec60defdbd95 Mon Sep 17 00:00:00 2001 From: Andrea Vos Date: Sun, 2 Oct 2022 09:29:22 +0200 Subject: [PATCH] [user] quick fix for customFlags array/object issue --- routes/profileEditor.vue | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/routes/profileEditor.vue b/routes/profileEditor.vue index 4455b2286..b476ef459 100644 --- a/routes/profileEditor.vue +++ b/routes/profileEditor.vue @@ -271,6 +271,10 @@ return words; } + function fixArrayObject(arrayObject) { + return Array.isArray(arrayObject) ? arrayObject : Object.values(arrayObject); + } + const buildProfile = (profiles, currentLocale) => { for (let locale in profiles) { if (!profiles.hasOwnProperty(locale)) { @@ -285,7 +289,7 @@ birthday: profile.birthday, links: profile.links, flags: profile.flags, - customFlags: profile.customFlags, + customFlags: fixArrayObject(profile.customFlags), words: coerceWords(profile.words), teamName: profile.teamName, footerName: profile.footerName, @@ -309,7 +313,7 @@ birthday: profile.birthday, links: profile.links, flags: profile.flags.filter(f => !f.startsWith('-')), - customFlags: profile.customFlags, + customFlags: fixArrayObject(profile.customFlags), words: [...defaultWords], teamName: profile.teamName, footerName: profile.footerName, @@ -327,7 +331,7 @@ birthday: null, links: [], flags: [], - customFlags: {}, + customFlags: [], words: [...defaultWords], teamName: '', footerName: '', @@ -385,7 +389,7 @@ birthday: formatDate(this.birthday), links: [...this.links], flags: [...this.flags], - customFlags: {...this.customFlags}, + customFlags: [...fixArrayObject(this.customFlags)], words: this.words, teamName: this.teamName,