fix: undefine unspecified parameters on profile updates

This commit is contained in:
naskya 2023-12-27 18:57:59 +09:00
parent 788f7d26d2
commit 57116f7371
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C
2 changed files with 7 additions and 7 deletions

View file

@ -118,7 +118,7 @@ export const paramDef = {
preventAiLearning: { type: "boolean" }, preventAiLearning: { type: "boolean" },
isBot: { type: "boolean" }, isBot: { type: "boolean" },
isCat: { type: "boolean" }, isCat: { type: "boolean" },
speakAsCat: { type: "boolean" }, speakAsCat: { type: "boolean", nullable: true },
isIndexable: { type: "boolean" }, isIndexable: { type: "boolean" },
injectFeaturedNote: { type: "boolean" }, injectFeaturedNote: { type: "boolean" },
receiveAnnouncementEmail: { type: "boolean" }, receiveAnnouncementEmail: { type: "boolean" },

View file

@ -231,14 +231,14 @@ function saveFields() {
function save() { function save() {
os.apiWithDialog("i/update", { os.apiWithDialog("i/update", {
name: profile.name || null, name: profile.name ?? undefined,
description: profile.description || null, description: profile.description ?? undefined,
location: profile.location || null, location: profile.location ?? undefined,
birthday: profile.birthday || null, birthday: profile.birthday ?? undefined,
lang: profile.lang || null, lang: profile.lang ?? undefined,
isBot: !!profile.isBot, isBot: !!profile.isBot,
isCat: !!profile.isCat, isCat: !!profile.isCat,
speakAsCat: !!profile.speakAsCat, speakAsCat: profile.isCat ? !!profile.speakAsCat : undefined,
}); });
} }