fix(people): 星盘档案 no longer prints 「本人不能删除」; 本人 shows the account avatar (BUG-2270)
The 本人 row and detail card use UserAvatar (uploaded picture, else the drawn one, same as the sidebar); without an account avatar the 「我」 circle stays. 本人 still has no delete entry. Per-person avatars for other people are next version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
This commit is contained in:
@@ -30535,3 +30535,20 @@
|
||||
- 修复:表头「最低线」;单元格「达到/未达到最低线」,参数敏感的行用 BUG-2243 原句「按本报告所用方法达到(或未达到)最低线;其他取法结果不同」;口径说明「默认用 PVR 表 30;另有一套例外划分,只在明确选用时才用」;计算说明「按本报告写明的各分量方法计算(网站 #166 方法)……换一种取法,个别行星是否达到最低线可能相反」。英文版未改。
|
||||
- 验证:`test_report_wording_sanitizer_20261111`、`test_report_fields_2065b`、`test_shadbala_defects_1961` 更新为新说法。
|
||||
- 修复版本:`claude/rect-casual-2256`。
|
||||
|
||||
## BUG-2270 | 星盘档案:本人详情印「本人不能删除」,本人的头像不是账号头像
|
||||
|
||||
- 状态:resolved(staging 待推)
|
||||
- 首次发现 / 最近更新:2026-11-23(负责人在 staging 星盘档案页截图)/ 2026-11-23
|
||||
- 现象:星盘档案的本人详情卡底部多一行「本人不能删除」;列表行和详情卡的本人头像是「我」字圆,没有显示账号头像(侧栏用的同一个头像)。
|
||||
- 触发条件:打开 `/people`,选中本人。
|
||||
- 根因:BUG-1081 时把「不能删」写成脚注提示;PeopleAvatar 只按名字首字和五行色画圆,没有读账号头像。
|
||||
- 修复:
|
||||
- `frontend/src/components/people/people-page.tsx`:脚注不再印这句;本人仍然没有删除入口(··· 菜单和编辑视图都只对 other 给删除,服务端 `/api/chart-profiles/[id]` 照旧 403)。
|
||||
- 本人行和详情卡用账号头像(`UserAvatar`:有上传的图片就显示图片,图片读不出或没上传就显示画出的头像,和侧栏同一套);账号没有头像时仍是「我」字圆。头像图片走原来的 `/api/account/avatar/image`,只给本人看,没有公开地址。
|
||||
- `frontend/src/app/globals.css`:`.people-archive-avatar.is-account`。
|
||||
- 验证:新增 `frontend/tests/profile-avatar-2270.test.tsx`(4 条);`people-archive-view`、`self-edit-people-20260928`、`chart-library-other-profile` 按新行为改写(注明原值 / 新值 / 原因);1280 / 390、浅 / 深色截图看过。
|
||||
- 防复发:测试钉住本人详情不出现「本人不能删除」、本人行和卡片读账号头像、其他人仍是首字圆。
|
||||
- 未做:给其他人上传头像(负责人 11-23 定为上线后第一个版本再做)。
|
||||
- 关联记录:BUG-1081(本人可编辑不可删)、BUG-2057 / BUG-2059(账号头像上传与显示)、BUG-2253(侧栏账号行)。
|
||||
- 修复版本:分支 `claude/profile-avatar-2270`(待父会话推送)。
|
||||
|
||||
@@ -7900,6 +7900,8 @@ button.report-ask-excerpt-toggle { height: 32px; padding: 0; color: var(--color-
|
||||
font-size: var(--type-title-md);
|
||||
}
|
||||
.people-archive-avatar.is-self { background: var(--color-action-strong); color: var(--color-on-dark); }
|
||||
/* BUG-2270: the 本人 row and card show the account avatar (drawn or uploaded) in the same circle. */
|
||||
.people-archive-avatar.is-account { overflow: hidden; background: var(--color-action-soft); }
|
||||
.people-archive-avatar.is-fire { background: var(--color-element-fire); }
|
||||
.people-archive-avatar.is-earth { background: var(--color-element-earth); }
|
||||
.people-archive-avatar.is-air { background: var(--color-element-air); }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useRef, useState, type Dispatch, type FormEvent, type ReactNode, type SetStateAction } from "react";
|
||||
import { createContext, useContext, useEffect, useRef, useState, type Dispatch, type FormEvent, type ReactNode, type SetStateAction } from "react";
|
||||
import { ChevronLeft, ChevronRight, FileText, MessageSquareText, MoreHorizontal, Orbit, Plus } from "lucide-react";
|
||||
import dynamic from "next/dynamic";
|
||||
|
||||
@@ -8,6 +8,9 @@ import { newChatHref } from "@/lib/chat-session-url";
|
||||
import { effectiveBirthDate } from "@/lib/effective-birth-date";
|
||||
import { personRelationLabel } from "@/lib/person-relation";
|
||||
import { SecondaryPageShell } from "@/components/secondary-page-shell";
|
||||
import { UserAvatar } from "@/components/user-avatar";
|
||||
import { avatarImageVersion } from "@/lib/avatar-crop";
|
||||
import type { BeamAvatar } from "@/lib/beam-avatar";
|
||||
import { bindCurrentSubjectAccount, invalidateSubjectCatalog, setCurrentSubject, useCurrentSubject } from "@/lib/current-subject";
|
||||
import { takeBootReadForPage, withBootFallback } from "@/lib/boot-early-reads";
|
||||
import { fetchAccount } from "@/lib/home-cloud-sync";
|
||||
@@ -124,7 +127,10 @@ export function PeoplePage() {
|
||||
const [saving, setSaving] = useState(false);
|
||||
const pushedDetail = useRef(false);
|
||||
const accountIdRef = useRef("");
|
||||
const { setAccount } = useSessionList();
|
||||
const { account, setAccount } = useSessionList();
|
||||
const selfAvatar: PeopleSelfAvatar | null = account?.avatar
|
||||
? { avatar: account.avatar, imageVersion: avatarImageVersion(account) }
|
||||
: null;
|
||||
|
||||
useEffect(() => { void loadChartProfileForm(); }, []);
|
||||
|
||||
@@ -403,6 +409,7 @@ export function PeoplePage() {
|
||||
) : null}
|
||||
{status === "ready" ? (
|
||||
<PeopleArchiveView
|
||||
selfAvatar={selfAvatar}
|
||||
people={people}
|
||||
subjectId={subjectId}
|
||||
selected={selected}
|
||||
@@ -432,8 +439,23 @@ export function PeoplePage() {
|
||||
);
|
||||
}
|
||||
|
||||
/** BUG-2270: the account's own avatar (drawn or uploaded), shown on the 本人 row and card. */
|
||||
export type PeopleSelfAvatar = { readonly avatar: BeamAvatar; readonly imageVersion: string | null };
|
||||
const SelfAvatarContext = createContext<PeopleSelfAvatar | null>(null);
|
||||
|
||||
function PeopleAvatar(props: { readonly person: PersonRow; readonly large?: boolean }) {
|
||||
const tone = peopleAvatarTone(props.person.id, props.person.role);
|
||||
const selfAvatar = useContext(SelfAvatarContext);
|
||||
if (props.person.role === "self" && selfAvatar) {
|
||||
return (
|
||||
<UserAvatar
|
||||
avatar={selfAvatar.avatar}
|
||||
imageVersion={selfAvatar.imageVersion}
|
||||
size={props.large ? 48 : 40}
|
||||
className={`people-archive-avatar is-account${props.large ? " is-large" : ""}`}
|
||||
/>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<span className={`people-archive-avatar is-${tone}${props.large ? " is-large" : ""}`} aria-hidden="true">
|
||||
{peopleAvatarInitial(props.person.profile, props.person.role)}
|
||||
@@ -465,6 +487,8 @@ export type PeopleArchiveViewProps = {
|
||||
readonly confirmDelete: () => Promise<void>;
|
||||
readonly openPerson: (id: string, href: string) => void;
|
||||
readonly onReorder?: (orderedIds: readonly string[]) => void;
|
||||
/** BUG-2270: the account avatar for the 本人 row and card; null keeps the 「我」 circle. */
|
||||
readonly selfAvatar?: PeopleSelfAvatar | null;
|
||||
};
|
||||
|
||||
function PersonCard(props: {
|
||||
@@ -549,6 +573,7 @@ export function PeopleArchiveView({
|
||||
confirmDelete,
|
||||
openPerson,
|
||||
onReorder,
|
||||
selfAvatar = null,
|
||||
}: PeopleArchiveViewProps) {
|
||||
const sortable = usePeopleArchiveSortable();
|
||||
const remaining = MAX_SAVED_SUBJECTS - people.length;
|
||||
@@ -583,6 +608,7 @@ export function PeopleArchiveView({
|
||||
}
|
||||
|
||||
return (
|
||||
<SelfAvatarContext.Provider value={selfAvatar}>
|
||||
<div className="people-archive" data-view={view}>
|
||||
<section className="people-archive-list" aria-label="星盘档案">
|
||||
<div className="people-archive-rows">
|
||||
@@ -675,7 +701,7 @@ export function PeopleArchiveView({
|
||||
) : null}
|
||||
{/* BUG-1081: 本人 is edited here too; only deleting stays off. */}
|
||||
<div className="people-archive-foot">
|
||||
{selected.role === "self" ? <p>本人不能删除</p> : null}
|
||||
{/* BUG-2270 原值:本人显示「本人不能删除」/ 新值:不印这句,本人照旧没有删除入口 / 原因:负责人 11-23,不要提示句。 */}
|
||||
<Button type="button" variant="outline" className="people-archive-secondary" onClick={() => onEdit(selected.profile)}>编辑</Button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -702,5 +728,6 @@ export function PeopleArchiveView({
|
||||
) : null}
|
||||
</section>
|
||||
</div>
|
||||
</SelfAvatarContext.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -95,7 +95,9 @@ test("the chart library starts as a list and only renders a form after a view ch
|
||||
test("other chart details own actions and self details cannot delete", () => {
|
||||
// 原值 / 新值 / 原因:旧 selfView/合盘历史面板 / 人物页本人不可删与本人合盘绑定 / 替代入口覆盖,不保留死组件。
|
||||
const charts = readFileSync(new URL("../src/components/people/people-page.tsx", import.meta.url), "utf8");
|
||||
assert.match(charts, /selected\.role === "self" \? <p>本人不能删除/);
|
||||
// 原值:本人详情印「本人不能删除」/ 新值:不印,删除入口仍只给 other / 原因:BUG-2270。
|
||||
assert.doesNotMatch(charts, /<p>本人不能删除/);
|
||||
assert.match(charts, /person\.role === "other" \? <DropdownMenuItem onClick=\{\(\) => props\.onDelete/);
|
||||
// 原值: the detail offered 设为默认.
|
||||
// 新值: that action is gone.
|
||||
// 原因: D11 removes "set as default".
|
||||
|
||||
@@ -181,9 +181,10 @@ test("D3 detail: header, two time cards (rectified in the success family), date,
|
||||
for (const label of ["和 TA 对话", "看星盘", "生成报告"]) assert.match(actions, new RegExp(label));
|
||||
});
|
||||
|
||||
test("D3 本人 has no delete anywhere; the grey foot says so", () => {
|
||||
test("D3 本人 has no delete anywhere and no hint line (BUG-2270)", () => {
|
||||
const markup = render({ view: "detail" });
|
||||
assert.match(markup, /class="people-archive-foot"><p>本人不能删除<\/p>/);
|
||||
// 原值:脚注印「本人不能删除」/ 新值:不印 / 原因:BUG-2270,负责人 11-23。
|
||||
assert.doesNotMatch(markup, /本人不能删除/);
|
||||
assert.doesNotMatch(markup, /删除这个人|确认删除/);
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import test from "node:test";
|
||||
import React from "react";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
|
||||
import { PeopleArchiveView, type PeopleArchiveViewProps, type PersonRow } from "../src/components/people/people-page.tsx";
|
||||
import { emptyProfile } from "../src/lib/home-types.ts";
|
||||
|
||||
Object.assign(globalThis, { React });
|
||||
|
||||
/* BUG-2270 (负责人 2026-11-23): 星盘档案 drops 「本人不能删除」, and 本人 shows the account avatar. Fictional people only. */
|
||||
const people: PersonRow[] = [
|
||||
{ id: "self", role: "self", incomplete: false, profile: { ...emptyProfile, name: "示例甲", date: "1990-01-02", time: "04:53" } },
|
||||
{ id: "p1", role: "other", incomplete: false, profile: { ...emptyProfile, name: "示例乙", date: "1991-03-04", time: "10:00" } },
|
||||
] as PersonRow[];
|
||||
|
||||
function render(overrides: Partial<PeopleArchiveViewProps> = {}): string {
|
||||
const noop = () => {};
|
||||
const asyncNoop = async () => {};
|
||||
const props: PeopleArchiveViewProps = {
|
||||
people, subjectId: "self", selected: people[0]!, selectedId: "self", view: "detail", editing: false,
|
||||
draft: emptyProfile, pendingDelete: null, saving: false, atLimit: false,
|
||||
onSelect: noop, onBack: noop, onAdd: noop, onEdit: noop, onCancelEdit: noop, onDraftChange: noop,
|
||||
saveOther: asyncNoop, saveSelf: asyncNoop, askDelete: asyncNoop, onCancelDelete: noop, confirmDelete: asyncNoop,
|
||||
openPerson: noop, ...overrides,
|
||||
};
|
||||
return renderToStaticMarkup(React.createElement(PeopleArchiveView, props));
|
||||
}
|
||||
|
||||
const avatar = { seed: "示例", palette: 0 } as never;
|
||||
|
||||
test("no 「本人不能删除」 line, and still no delete for 本人", () => {
|
||||
const markup = render();
|
||||
assert.doesNotMatch(markup, /本人不能删除/);
|
||||
assert.doesNotMatch(markup, /删除这个人|确认删除/);
|
||||
});
|
||||
|
||||
test("本人 row and card show the account's uploaded picture when there is one", () => {
|
||||
const markup = render({ selfAvatar: { avatar, imageVersion: "v7" } });
|
||||
const images = markup.match(/<img[^>]*class="user-avatar-image"[^>]*>/gu) ?? [];
|
||||
assert.equal(images.length, 2, "row + detail card");
|
||||
for (const image of images) assert.match(image, /src="\/api\/account\/avatar\/image\?v=v7"|src="\/api\/account\/avatar\/image[^"]*v7/u);
|
||||
assert.match(markup, /people-archive-avatar is-account is-large/);
|
||||
// Other people keep their initial circle.
|
||||
assert.equal((markup.match(/is-account/gu) ?? []).length, 2);
|
||||
assert.match(markup, /<span class="people-archive-avatar is-(?!account|self)[a-z]+"/u);
|
||||
});
|
||||
|
||||
test("drawn avatar when nothing is uploaded; 「我」 circle when there is no account avatar", () => {
|
||||
const drawn = render({ selfAvatar: { avatar, imageVersion: null } });
|
||||
assert.doesNotMatch(drawn, /user-avatar-image/);
|
||||
assert.match(drawn, /user-avatar people-archive-avatar is-account/);
|
||||
const fallback = render({ selfAvatar: null });
|
||||
assert.doesNotMatch(fallback, /is-account/);
|
||||
assert.match(fallback, /people-archive-avatar is-self[^"]*"[^>]*>我</u);
|
||||
});
|
||||
|
||||
test("the is-account class is defined in the stylesheet", () => {
|
||||
const css = readFileSync(new URL("../src/app/globals.css", import.meta.url), "utf8");
|
||||
assert.match(css, /\.people-archive-avatar\.is-account\s*\{[^}]*overflow:\s*hidden/u);
|
||||
});
|
||||
@@ -64,12 +64,14 @@ function fakeFetch(status: number, body: unknown, calls: Call[]): typeof fetch {
|
||||
}) as typeof fetch;
|
||||
}
|
||||
|
||||
test("本人 detail offers 编辑 and still says it cannot be deleted", () => {
|
||||
test("本人 detail offers 编辑 and has no delete (no hint line, BUG-2270)", () => {
|
||||
const detail = render();
|
||||
// 原值:脚注里的编辑按钮 class 只有 people-archive-secondary,500 字内出现「编辑」
|
||||
// 新值:脚注仍先写「本人不能删除」,1600 字内出现「编辑」
|
||||
// 原因:K4 编辑按钮改用 Button,组件库样式写在同一个 class 里,比原来长
|
||||
assert.match(detail, /class="people-archive-foot"><p>本人不能删除<\/p>[\s\S]{0,1600}编辑/);
|
||||
// 原值(2):脚注先写「本人不能删除」/ 新值(2):脚注只有「编辑」,不印这句 / 原因(2):BUG-2270,负责人 11-23 不要提示句。
|
||||
assert.match(detail, /class="people-archive-foot">[\s\S]{0,1600}编辑/);
|
||||
assert.doesNotMatch(detail, /本人不能删除/);
|
||||
assert.doesNotMatch(detail, /删除这个人|确认删除/);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user