修复创作页精选作者和瀑布流宽度

公开精选接口返回作者展示名和陶泥号

前端精选作者只使用公开展示字段,不再兜底内部用户 ID

约束精选瀑布流多列容器宽度,避免 release 桌面端横向撑宽

补充前后端回归测试和项目记忆文档
This commit is contained in:
2026-06-27 20:01:17 +08:00
parent bb51c7e0d2
commit f20f4e0f8e
10 changed files with 188 additions and 25 deletions
@@ -235,7 +235,9 @@ describe('CreationLandingView', () => {
provider: 'provider',
taskId: 'task-1',
assetKind: 'character',
authorName: '创作者A',
ownerUserId: 'user-internal-author',
authorDisplayName: '创作者A',
authorPublicUserCode: 'SY-00000042',
priceMudPoints: 20,
},
]);
@@ -249,6 +251,7 @@ describe('CreationLandingView', () => {
expect(card).toBeTruthy();
expect(within(card as HTMLElement).getByText('character hero prompt')).toBeTruthy();
expect(within(card as HTMLElement).getByText('创作者A')).toBeTruthy();
expect(within(card as HTMLElement).queryByText('user-internal-author')).toBeNull();
expect(within(card as HTMLElement).getByText('20泥点')).toBeTruthy();
});
@@ -270,7 +273,8 @@ describe('CreationLandingView', () => {
provider: 'provider',
taskId: 'task-1',
assetKind: 'character',
authorName: '创作者A',
authorDisplayName: '创作者A',
authorPublicUserCode: 'SY-00000042',
priceMudPoints: 20,
},
{
@@ -76,21 +76,41 @@ describe('creationShowcaseModel', () => {
expect(items[0]?.label).toBe('公开素材');
});
it('uses the public project resource owner user id as showcase author fallback', () => {
it('uses public author fields without falling back to internal owner user id', () => {
const items = buildCreationShowcaseItems({
activeTab: 'characters',
projectResources: [
createResource({
resourceId: 'owner-resource',
label: '作者兜底素材',
resourceId: 'display-author-resource',
label: '展示名作者素材',
assetKind: 'character',
ownerUserId: 'user-author-1',
authorDisplayName: '作者昵称',
authorPublicUserCode: 'SY-00000001',
}),
createResource({
resourceId: 'code-author-resource',
label: '陶泥号作者素材',
assetKind: 'character',
ownerUserId: 'user-author-2',
authorPublicUserCode: 'SY-00000002',
}),
createResource({
resourceId: 'owner-only-resource',
label: '内部id素材',
assetKind: 'character',
ownerUserId: 'user-author-3',
authorName: 'user-author-3',
ownerName: 'user-author-3',
}),
],
});
expect(items).toHaveLength(1);
expect(items[0]?.author).toBe('user-author-1');
expect(items.map((item) => item.author)).toEqual([
'作者昵称',
'SY-00000002',
'-',
]);
});
it('deduplicates canvas copies that point back to the same generated resource', () => {
@@ -137,7 +157,7 @@ describe('creationShowcaseModel', () => {
assetKind: 'spec',
prompt: '规范提示词',
priceMudPoints: 5,
authorName: '创作者A',
authorDisplayName: '创作者A',
}),
createResource({
resourceId: 'character-1',
@@ -62,14 +62,7 @@ const SHOWCASE_COST_KEYS = [
'mudPointCost',
] as const;
const SHOWCASE_AUTHOR_KEYS = [
'authorName',
'creatorName',
'ownerLabel',
'ownerName',
'authorDisplayName',
'ownerUserId',
] as const;
const SHOWCASE_AUTHOR_KEYS = ['authorDisplayName', 'authorPublicUserCode'] as const;
export const SHOWCASE_TABS: Array<{ id: ShowcaseTabId; label: string }> = [
{ id: 'packs', label: '素材包' },