fix(api-profile-filter) fix editor for the case when we copy non-language-specific fields from existing card in other language

This commit is contained in:
Andrea Vos 2023-06-03 10:27:06 +02:00
parent 3ea38751ca
commit fbc582507b

View File

@ -330,10 +330,9 @@
})
const buildProfile = (profiles, currentLocale) => {
// card in this locale exists
for (let locale in profiles) {
if (!profiles.hasOwnProperty(locale)) {
continue;
}
if (!profiles.hasOwnProperty(locale)) { continue; }
if (locale === currentLocale) {
const profile = profiles[locale];
return {
@ -359,10 +358,9 @@
}
}
// card in this locale doesn't exist yet, but we can copy some non-language-specific fields from another card
for (let locale in profiles) {
if (!profiles.hasOwnProperty(locale)) {
continue;
}
if (!profiles.hasOwnProperty(locale)) { continue; }
const profile = profiles[locale];
return {
names: profile.names,
@ -386,6 +384,7 @@
};
}
// no cards in other languages available, start with a fresh one
return {
names: [],
pronouns: [],
@ -430,7 +429,7 @@
const currentLocale = app.context.env.LOCALE;
const profiles = (await app.$axios.$get(`/profile/get/${encodeURIComponent(store.state.user.username)}?version=2&props=flags,pronouns&lprops[${currentLocale}]=all`, { headers: {
const profiles = (await app.$axios.$get(`/profile/get/${encodeURIComponent(store.state.user.username)}?version=2&props=flags,pronouns,names,age,timezone,links,customFlags,team,opinions,circle&lprops[${currentLocale}]=all`, { headers: {
authorization: 'Bearer ' + store.state.token,
} })).profiles;