修复创作页精选作者和瀑布流宽度
公开精选接口返回作者展示名和陶泥号 前端精选作者只使用公开展示字段,不再兜底内部用户 ID 约束精选瀑布流多列容器宽度,避免 release 桌面端横向撑宽 补充前后端回归测试和项目记忆文档
This commit is contained in:
@@ -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: '素材包' },
|
||||
|
||||
@@ -3771,6 +3771,8 @@ html[data-mobile-keyboard-open='true'] .platform-mobile-bottom-dock {
|
||||
}
|
||||
|
||||
.creation-landing__asset-waterfall {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
column-count: 3;
|
||||
column-gap: 0.92rem;
|
||||
}
|
||||
|
||||
@@ -221,6 +221,8 @@ describe('editorProjectClient', () => {
|
||||
resourceId: 'resource-public-1',
|
||||
projectId: 'editor-project-1',
|
||||
ownerUserId: 'user-public-author',
|
||||
authorDisplayName: '公开作者',
|
||||
authorPublicUserCode: 'SY-00000042',
|
||||
label: '公开角色素材',
|
||||
imageSrc: '/generated-editor-assets/public.png',
|
||||
width: 512,
|
||||
@@ -236,6 +238,8 @@ describe('editorProjectClient', () => {
|
||||
expect(resources).toHaveLength(1);
|
||||
expect(resources[0]?.resourceId).toBe('resource-public-1');
|
||||
expect(resources[0]?.ownerUserId).toBe('user-public-author');
|
||||
expect(resources[0]?.authorDisplayName).toBe('公开作者');
|
||||
expect(resources[0]?.authorPublicUserCode).toBe('SY-00000042');
|
||||
expect(requestJsonMock).toHaveBeenCalledWith(
|
||||
'/api/editor/showcase/resources',
|
||||
{ method: 'GET' },
|
||||
|
||||
@@ -60,6 +60,8 @@ export type EditorProjectResourceSnapshot = {
|
||||
resourceId: string;
|
||||
projectId: string;
|
||||
ownerUserId?: string | null;
|
||||
authorDisplayName?: string | null;
|
||||
authorPublicUserCode?: string | null;
|
||||
imageSrc: string;
|
||||
objectKey?: string | null;
|
||||
assetObjectId?: string | null;
|
||||
|
||||
Reference in New Issue
Block a user