Skip to content

Commit f086c78

Browse files
authored
fix: curation issues (#3348)
1 parent 379e03a commit f086c78

File tree

7 files changed

+52
-17
lines changed

7 files changed

+52
-17
lines changed

src/components/Modals/CreateSingleItemModal/CreateSingleItemModal.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { getImageType, dataURLToBlob } from 'modules/media/utils'
2626
import { ImageType } from 'modules/media/types'
2727
import {
2828
THUMBNAIL_PATH,
29+
IMAGE_PATH,
2930
Item,
3031
BodyShapeType,
3132
WearableRepresentation,
@@ -719,10 +720,12 @@ export const CreateSingleItemModal: React.FC<Props> = props => {
719720

720721
const handleFileLoad = useCallback(async () => {
721722
const { weareblePreviewUpdated, type, model, item, contents } = state
723+
const { [THUMBNAIL_PATH]: _thumbnail, [IMAGE_PATH]: _image, [VIDEO_PATH]: _video, ...modelContents } = contents ?? {}
724+
const { [THUMBNAIL_PATH]: _oldThumbnail, [IMAGE_PATH]: _oldImage, [VIDEO_PATH]: _oldVideo, ...oldModelContents } = item?.contents ?? {}
722725

723726
const modelSize = await calculateModelFinalSize(
724-
item?.contents ?? {},
725-
contents ?? {},
727+
oldModelContents,
728+
modelContents,
726729
type ?? ItemType.WEARABLE,
727730
new BuilderAPI(BUILDER_SERVER_URL, new Authorization(() => props.address))
728731
)

src/modules/entity/sagas.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,18 @@ export function* entitySaga(catalystClient: CatalystClient) {
6161
throw new Error('Invalid Identity')
6262
}
6363
const contentClient: ContentClient = yield call([catalystClient, 'getContentClient'])
64-
yield all(
64+
const responses: Response[] = yield all(
6565
entities.map(entity =>
6666
call([contentClient, 'deploy'], { ...entity, authChain: Authenticator.signPayload(identity, entity.entityId) })
6767
)
6868
)
6969

70+
const failedResponse = responses.find(r => !r.ok)
71+
if (failedResponse) {
72+
const { errors } = yield call([failedResponse, 'json'])
73+
throw new Error(`Deploy failed with status ${failedResponse.status}: ${errors.join(' ') ?? 'Unknown error'}`)
74+
}
75+
7076
yield put(deployEntitiesSuccess(entities))
7177
} catch (error) {
7278
yield put(deployEntitiesFailure(entities, isErrorWithMessage(error) ? error.message : 'Unknown error'))

src/modules/item/sagas.spec.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,8 @@ describe('when handling the save item request action', () => {
367367
})
368368

369369
it('should put a save item success action with the catalyst image', () => {
370-
const { [THUMBNAIL_PATH]: thumbnailContent, ...modelContents } = contentsToSave
371-
const { [THUMBNAIL_PATH]: _, ...itemContents } = itemWithCatalystImage.contents
370+
const { [THUMBNAIL_PATH]: thumbnailContent, [IMAGE_PATH]: _imageContent, ...modelContents } = contentsToSave
371+
const { [THUMBNAIL_PATH]: _, [IMAGE_PATH]: _itemImageContent, ...itemContents } = itemWithCatalystImage.contents
372372
return expectSaga(itemSaga, builderAPI, builderClient, tradeService)
373373
.provide([
374374
[matchers.call.fn(reHashOlderContents), {}],
@@ -400,8 +400,8 @@ describe('when handling the save item request action', () => {
400400
})
401401

402402
it('should put a save item success action without a new catalyst image', () => {
403-
const { [THUMBNAIL_PATH]: thumbnailContent, ...modelContents } = contents
404-
const { [THUMBNAIL_PATH]: _, ...itemContents } = item.contents
403+
const { [THUMBNAIL_PATH]: thumbnailContent, [IMAGE_PATH]: _imageContent, ...modelContents } = contents
404+
const { [THUMBNAIL_PATH]: _, [IMAGE_PATH]: _itemImageContent, ...itemContents } = item.contents
405405
return expectSaga(itemSaga, builderAPI, builderClient, tradeService)
406406
.provide([
407407
[matchers.call.fn(reHashOlderContents), {}],
@@ -432,8 +432,8 @@ describe('when handling the save item request action', () => {
432432
})
433433

434434
it('should put a save item success action with a new catalyst image', () => {
435-
const { [THUMBNAIL_PATH]: thumbnailContent, ...modelContents } = newContentsContainingNewCatalystImage
436-
const { [THUMBNAIL_PATH]: _, ...itemContents } = itemWithCatalystImage.contents
435+
const { [THUMBNAIL_PATH]: thumbnailContent, [IMAGE_PATH]: _imageContent, ...modelContents } = newContentsContainingNewCatalystImage
436+
const { [THUMBNAIL_PATH]: _, [IMAGE_PATH]: _itemImageContent, ...itemContents } = itemWithCatalystImage.contents
437437
return expectSaga(itemSaga, builderAPI, builderClient, tradeService)
438438
.provide([
439439
[matchers.call.fn(reHashOlderContents), {}],
@@ -471,8 +471,8 @@ describe('when handling the save item request action', () => {
471471
})
472472

473473
it('should put a save item success action', () => {
474-
const { [THUMBNAIL_PATH]: thumbnailContent, ...modelContents } = contents
475-
const { [THUMBNAIL_PATH]: _, ...itemContents } = item.contents
474+
const { [THUMBNAIL_PATH]: thumbnailContent, [IMAGE_PATH]: _imageContent, ...modelContents } = contents
475+
const { [THUMBNAIL_PATH]: _, [IMAGE_PATH]: _itemImageContent, ...itemContents } = item.contents
476476
return expectSaga(itemSaga, builderAPI, builderClient, tradeService)
477477
.provide([
478478
[matchers.call.fn(reHashOlderContents), {}],
@@ -498,8 +498,8 @@ describe('when handling the save item request action', () => {
498498
})
499499

500500
it('should save item if it is already published', () => {
501-
const { [THUMBNAIL_PATH]: thumbnailContent, ...modelContents } = contents
502-
const { [THUMBNAIL_PATH]: _, ...itemContents } = item.contents
501+
const { [THUMBNAIL_PATH]: thumbnailContent, [IMAGE_PATH]: _imageContent, ...modelContents } = contents
502+
const { [THUMBNAIL_PATH]: _, [IMAGE_PATH]: _itemImageContent, ...itemContents } = item.contents
503503
return expectSaga(itemSaga, builderAPI, builderClient, tradeService)
504504
.provide([
505505
[matchers.call.fn(reHashOlderContents), {}],
@@ -553,8 +553,8 @@ describe('when handling the save item request action', () => {
553553
})
554554

555555
it("should update the item's content with the new hash and upload the files", () => {
556-
const { [THUMBNAIL_PATH]: thumbnailContent, ...modelContents } = newContents
557-
const { [THUMBNAIL_PATH]: _, ...itemContents } = itemWithNewHashes.contents
556+
const { [THUMBNAIL_PATH]: thumbnailContent, [IMAGE_PATH]: _imageContent, ...modelContents } = newContents
557+
const { [THUMBNAIL_PATH]: _, [IMAGE_PATH]: _itemImageContent, ...itemContents } = itemWithNewHashes.contents
558558
return expectSaga(itemSaga, builderAPI, builderClient, tradeService)
559559
.provide([
560560
[

src/modules/item/sagas.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,13 @@ export function* itemSaga(legacyBuilder: LegacyBuilderAPI, builder: BuilderClien
451451

452452
if (Object.keys(contents).length > 0 || shouldValidateCategoryChanged) {
453453
// Extract the thumbnail from the contents to calculate the size using another limit
454-
const { [THUMBNAIL_PATH]: thumbnailContent, [VIDEO_PATH]: videoContent, ...modelContents } = contents
455-
const { [THUMBNAIL_PATH]: _thumbnailContent, [VIDEO_PATH]: _videoContent, ...itemContents } = item.contents
454+
const { [THUMBNAIL_PATH]: thumbnailContent, [VIDEO_PATH]: videoContent, [IMAGE_PATH]: imageContent, ...modelContents } = contents
455+
const {
456+
[THUMBNAIL_PATH]: _thumbnailContent,
457+
[VIDEO_PATH]: _videoContent,
458+
[IMAGE_PATH]: _imageContent,
459+
...itemContents
460+
} = item.contents
456461
// This will calculate the model's final size without the thumbnail with a limit of 2MB for wearables/emotes and 8MB for skins
457462
const finalModelSize: number = yield call(calculateModelFinalSize, itemContents, modelContents, item.type, legacyBuilder)
458463
let finalThumbnailSize = 0

src/modules/translation/languages/en.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2041,6 +2041,7 @@
20412041
"reject": "Reject",
20422042
"enable": "Enable",
20432043
"disable": "Disable",
2044+
"deploy_missing_entities": "Deploy Missing Entities",
20442045
"rejection_modal": {
20452046
"discussion": "Discussion",
20462047
"forum_link": "Forum link",
@@ -2157,6 +2158,12 @@
21572158
}
21582159
}
21592160
},
2161+
"deploy_entities_modal": {
2162+
"success_title": "Success",
2163+
"error_title": "Error",
2164+
"success_message": "The items were successfully uploaded for collection: <b>{name}</b>",
2165+
"error_message": "There was an error uploading the items for collection: <b>{name}</b>"
2166+
},
21602167
"video_showcase_modal": {
21612168
"title": "Detailed Video of your Smart Wearable",
21622169
"back": "Back",

src/modules/translation/languages/es.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2056,6 +2056,7 @@
20562056
"reject": "Rechazar",
20572057
"enable": "Habilitar",
20582058
"disable": "Deshabilitar",
2059+
"deploy_missing_entities": "Subir Entidades Faltantes",
20592060
"rejection_modal": {
20602061
"veredict_explanation": "Puedes contarnos por qué?",
20612062
"visit_activity": "Puedes visitar tu {activity_link} para monitoriear la transacción",
@@ -2175,6 +2176,12 @@
21752176
}
21762177
}
21772178
},
2179+
"deploy_entities_modal": {
2180+
"success_title": "Éxito",
2181+
"error_title": "Error",
2182+
"success_message": "Los elementos se subieron exitosamente para la colección: <b>{name}</b>",
2183+
"error_message": "Hubo un error al subir los elementos para la colección: <b>{name}</b>"
2184+
},
21782185
"video_showcase_modal": {
21792186
"title": "Video detallado de su Vestimenta Interactiva",
21802187
"back": "Volver",

src/modules/translation/languages/zh.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2037,6 +2037,7 @@
20372037
"reject": "拒绝",
20382038
"enable": "使",
20392039
"disable": "禁用",
2040+
"deploy_missing_entities": "部署缺失实体",
20402041
"rejection_modal": {
20412042
"veredict_explanation": "你能告诉我们为什么吗?",
20422043
"visit_activity": "您可以检查您的 {activity_link} 以监控交易",
@@ -2156,6 +2157,12 @@
21562157
}
21572158
}
21582159
},
2160+
"deploy_entities_modal": {
2161+
"success_title": "成功",
2162+
"error_title": "错误",
2163+
"success_message": "集合的道具已成功上传:<b>{name}</b>",
2164+
"error_message": "上传集合的道具时出错:<b>{name}</b>"
2165+
},
21592166
"video_showcase_modal": {
21602167
"title": "您智能可穿戴的详细视频",
21612168
"back": "后退",

0 commit comments

Comments
 (0)