From f676cc1f19f7abd19bc1733d9e31296fd8fc5ceb Mon Sep 17 00:00:00 2001 From: naskya Date: Wed, 27 Dec 2023 18:57:59 +0900 Subject: [PATCH] fix: undefine unspecified parameters on profile updates --- .../backend/src/server/api/endpoints/i/update.ts | 2 +- packages/client/src/pages/settings/profile.vue | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/i/update.ts b/packages/backend/src/server/api/endpoints/i/update.ts index c438a33c5..c3ae9c520 100644 --- a/packages/backend/src/server/api/endpoints/i/update.ts +++ b/packages/backend/src/server/api/endpoints/i/update.ts @@ -118,7 +118,7 @@ export const paramDef = { preventAiLearning: { type: "boolean" }, isBot: { type: "boolean" }, isCat: { type: "boolean" }, - speakAsCat: { type: "boolean" }, + speakAsCat: { type: "boolean", nullable: true }, isIndexable: { type: "boolean" }, injectFeaturedNote: { type: "boolean" }, receiveAnnouncementEmail: { type: "boolean" }, diff --git a/packages/client/src/pages/settings/profile.vue b/packages/client/src/pages/settings/profile.vue index 7de6bba94..98b312acf 100644 --- a/packages/client/src/pages/settings/profile.vue +++ b/packages/client/src/pages/settings/profile.vue @@ -231,14 +231,14 @@ function saveFields() { function save() { os.apiWithDialog("i/update", { - name: profile.name || null, - description: profile.description || null, - location: profile.location || null, - birthday: profile.birthday || null, - lang: profile.lang || null, + name: profile.name ?? undefined, + description: profile.description ?? undefined, + location: profile.location ?? undefined, + birthday: profile.birthday ?? undefined, + lang: profile.lang ?? undefined, isBot: !!profile.isBot, isCat: !!profile.isCat, - speakAsCat: !!profile.speakAsCat, + speakAsCat: profile.isCat ? !!profile.speakAsCat : undefined, }); }