修复精选栏用户id显示
公开精选资源接口透传 ownerUserId 精选模型使用 ownerUserId 作为作者兜底 补充前后端回归测试和相关文档
This commit is contained in:
@@ -76,6 +76,23 @@ describe('creationShowcaseModel', () => {
|
||||
expect(items[0]?.label).toBe('公开素材');
|
||||
});
|
||||
|
||||
it('uses the public project resource owner user id as showcase author fallback', () => {
|
||||
const items = buildCreationShowcaseItems({
|
||||
activeTab: 'characters',
|
||||
projectResources: [
|
||||
createResource({
|
||||
resourceId: 'owner-resource',
|
||||
label: '作者兜底素材',
|
||||
assetKind: 'character',
|
||||
ownerUserId: 'user-author-1',
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
expect(items).toHaveLength(1);
|
||||
expect(items[0]?.author).toBe('user-author-1');
|
||||
});
|
||||
|
||||
it('deduplicates canvas copies that point back to the same generated resource', () => {
|
||||
const items = buildCreationShowcaseItems({
|
||||
activeTab: 'characters',
|
||||
|
||||
@@ -68,6 +68,7 @@ const SHOWCASE_AUTHOR_KEYS = [
|
||||
'ownerLabel',
|
||||
'ownerName',
|
||||
'authorDisplayName',
|
||||
'ownerUserId',
|
||||
] as const;
|
||||
|
||||
export const SHOWCASE_TABS: Array<{ id: ShowcaseTabId; label: string }> = [
|
||||
|
||||
@@ -220,6 +220,7 @@ describe('editorProjectClient', () => {
|
||||
{
|
||||
resourceId: 'resource-public-1',
|
||||
projectId: 'editor-project-1',
|
||||
ownerUserId: 'user-public-author',
|
||||
label: '公开角色素材',
|
||||
imageSrc: '/generated-editor-assets/public.png',
|
||||
width: 512,
|
||||
@@ -234,6 +235,7 @@ describe('editorProjectClient', () => {
|
||||
|
||||
expect(resources).toHaveLength(1);
|
||||
expect(resources[0]?.resourceId).toBe('resource-public-1');
|
||||
expect(resources[0]?.ownerUserId).toBe('user-public-author');
|
||||
expect(requestJsonMock).toHaveBeenCalledWith(
|
||||
'/api/editor/showcase/resources',
|
||||
{ method: 'GET' },
|
||||
|
||||
@@ -59,6 +59,7 @@ export type EditorProjectResourceSourceType =
|
||||
export type EditorProjectResourceSnapshot = {
|
||||
resourceId: string;
|
||||
projectId: string;
|
||||
ownerUserId?: string | null;
|
||||
imageSrc: string;
|
||||
objectKey?: string | null;
|
||||
assetObjectId?: string | null;
|
||||
|
||||
Reference in New Issue
Block a user