fix(settings): gender is set only in the people archive; drop the 个人资料 duplicate (BUG-1119)
Independent Staging Quality Gate / publish (push) Canceled after 0s
Independent Staging Quality Gate / validate (push) Canceled after 7m59s

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N4f2nya58RoRu4yEmJgRGE
This commit is contained in:
Jesse_Chen
2026-09-30 11:11:47 +08:00
co-authored by Claude Opus 5.5
parent 3177ffe61d
commit 3e29b697db
8 changed files with 34 additions and 79 deletions
@@ -29,7 +29,6 @@ import {
readProfile,
selectedBirthPlace,
} from "@/lib/home-profile";
import { withSavedGender, type ProfileGender } from "@/lib/profile-gender";
import { saveSelfProfile } from "@/lib/self-profile-save";
import { createStartGreeting } from "@/lib/starter-greeting";
import { clearHomeWarmSnapshot } from "@/lib/home-warm-snapshot";
@@ -194,26 +193,6 @@ export function useProfileOnboarding(params: ProfileOnboardingParams) {
}
}
/**
* The owner's optional gender (设置 → 个人资料). A PATCH of this one field:
* birth-data saves never send it, so they can never clear it.
*/
async function persistGender(gender: ProfileGender | null): Promise<void> {
if (!account) throw new Error("账户尚未加载完成");
const response = await fetch("/api/account", {
method: "PATCH",
credentials: "same-origin",
headers: { "content-type": "application/json" },
body: JSON.stringify({ gender }),
});
const payload = await response.json().catch(() => null) as { error?: string } | null;
if (!response.ok) throw new Error(payload?.error || "性别没保存上,再试一次。");
const apply = (current: Profile): Profile => ({ ...current, gender });
setProfile(apply);
setProfileDraft(apply);
setAccount((current) => current ? { ...current, profile: withSavedGender(current.profile, gender) } : current);
}
async function persistProfile(nextProfile: Profile): Promise<Profile> {
if (!account) throw new Error("账户尚未加载完成");
if (process.env.NODE_ENV === "development" && uiPreview.current) return nextProfile;
@@ -384,7 +363,6 @@ export function useProfileOnboarding(params: ProfileOnboardingParams) {
openAccountDialog,
closeAccountDialog,
persistAvatar,
persistGender,
persistProfile,
assessSavedBirthTime,
saveOnboardingName,