* change judgement of duplicate textures * fix test
This commit is contained in:
parent
f721ac269c
commit
1b0e1b154b
@ -252,7 +252,7 @@ class SkinlibController extends Controller
|
||||
foreach ($results as $result) {
|
||||
// if the texture already uploaded was set to private,
|
||||
// then allow to re-upload it.
|
||||
if ($result->type == $t->type && $result->public) {
|
||||
if ($result->public) {
|
||||
return json(trans('skinlib.upload.repeated'), 0, ['tid' => $result->tid]);
|
||||
}
|
||||
}
|
||||
@ -391,14 +391,6 @@ class SkinlibController extends Controller
|
||||
return json(trans('skinlib.no-permission'), 1);
|
||||
}
|
||||
|
||||
$duplicate = Texture::where('hash', $t->hash)
|
||||
->where('type', $request->input('model'))
|
||||
->where('tid', '<>', $t->tid)
|
||||
->first();
|
||||
if ($duplicate && $duplicate->public) {
|
||||
return json(trans('skinlib.model.duplicate', ['name' => $duplicate->name]), 1);
|
||||
}
|
||||
|
||||
$t->type = $request->input('model');
|
||||
$t->save();
|
||||
|
||||
|
@ -88,7 +88,6 @@ rename:
|
||||
|
||||
model:
|
||||
success: The texture's model was changed to :model successfully.
|
||||
duplicate: "The same texture available for the chosen model already exists in skinlib (Name: :name). You can add it to your closet directly."
|
||||
|
||||
no-permission: You have no permission to moderate this texture.
|
||||
non-existent: No such texture.
|
||||
|
@ -947,17 +947,6 @@ class SkinlibControllerTest extends TestCase
|
||||
'hash' => $texture->hash,
|
||||
]);
|
||||
|
||||
// Should fail if there is already a texture with same hash and chosen model
|
||||
$this->actingAs($uploader)
|
||||
->postJson('/skinlib/model', [
|
||||
'tid' => $texture->tid,
|
||||
'model' => 'alex',
|
||||
])
|
||||
->assertJson([
|
||||
'code' => 1,
|
||||
'message' => trans('skinlib.model.duplicate', ['name' => $duplicate->name]),
|
||||
]);
|
||||
|
||||
// Allow private texture
|
||||
$duplicate->public = false;
|
||||
$duplicate->save();
|
||||
|
Loading…
Reference in New Issue
Block a user