fix "score cost per closet item" isn't calculated
at "texture upload" page
This commit is contained in:
parent
998c5f011a
commit
ed04dd1740
|
|
@ -211,6 +211,7 @@ class SkinlibController extends Controller
|
|||
),
|
||||
'scorePublic' => intval(option('score_per_storage')),
|
||||
'scorePrivate' => intval(option('private_score_per_storage')),
|
||||
'closetItemCost' => intval(option('score_per_closet_item')),
|
||||
'award' => intval(option('score_award_per_texture')),
|
||||
'contentPolicy' => $parsedown->text(option_localized('content_policy')),
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ const Upload: React.FC = () => {
|
|||
const award = useBlessingExtra<number>('award')
|
||||
const scorePublic = useBlessingExtra<number>('scorePublic')
|
||||
const scorePrivate = useBlessingExtra<number>('scorePrivate')
|
||||
const closetItemCost = useBlessingExtra<number>('closetItemCost')
|
||||
|
||||
useEffect(() => {
|
||||
const mount = document.querySelector('#previewer')!
|
||||
|
|
@ -119,6 +120,8 @@ const Upload: React.FC = () => {
|
|||
}
|
||||
|
||||
const costRatio = isPrivate ? scorePrivate : scorePublic
|
||||
const size = file?.size ?? 0
|
||||
const scoreCost = (~~(size / 1024) || 1) * costRatio + closetItemCost
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
@ -241,11 +244,7 @@ const Upload: React.FC = () => {
|
|||
</div>
|
||||
{file && (
|
||||
<div className="callout callout-success mt-3">
|
||||
<p>
|
||||
{t('skinlib.upload.cost', {
|
||||
score: (~~(file.size / 1024) || 1) * costRatio,
|
||||
})}
|
||||
</p>
|
||||
<p>{t('skinlib.upload.cost', { score: scoreCost })}</p>
|
||||
</div>
|
||||
)}
|
||||
{isPrivate && (
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ beforeEach(() => {
|
|||
privacyNotice: 'privacy notice',
|
||||
scorePrivate: 10,
|
||||
scorePublic: 1,
|
||||
closetItemCost: 10,
|
||||
award: 0,
|
||||
contentPolicy: 'the policy',
|
||||
}
|
||||
|
|
@ -145,7 +146,7 @@ describe('score cost', () => {
|
|||
})
|
||||
|
||||
expect(
|
||||
queryByText(t('skinlib.upload.cost', { score: 1 })),
|
||||
queryByText(t('skinlib.upload.cost', { score: 11 })),
|
||||
).toBeInTheDocument()
|
||||
})
|
||||
|
||||
|
|
@ -159,7 +160,7 @@ describe('score cost', () => {
|
|||
fireEvent.click(getByLabelText(t('skinlib.upload.set-as-private')))
|
||||
|
||||
expect(
|
||||
queryByText(t('skinlib.upload.cost', { score: 10 })),
|
||||
queryByText(t('skinlib.upload.cost', { score: 20 })),
|
||||
).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@
|
|||
- Fixed that avatar can't be resized when requesting an non-existed user.
|
||||
- Fixed that the same texture files with different models were treated as different textures. (Thanks [Steven Qiu](https://github.com/tnqzh123))
|
||||
- Fixed when uploading duplicated texture, alert is missing.
|
||||
- Fixed that "score cost per closet item" isn't calculated at "texture upload" page.
|
||||
|
||||
## Removed
|
||||
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@
|
|||
- 修复获取不存在的用户的头像时,未能正确设置尺寸的问题
|
||||
- 修复同一材质文件但模型不同被认为不同材质的问题(感谢 [Steven Qiu](https://github.com/tnqzh123))
|
||||
- 修复上传重复材质时没有提示用户的问题
|
||||
- 「材质上传」页面的积分消耗没有计算衣柜收藏所需的积分
|
||||
|
||||
## 移除
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user