Fix #104
This commit is contained in:
parent
64d8b44a13
commit
6c7b494f16
@ -216,25 +216,16 @@ class SkinlibController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (option('return_score')) {
|
if (option('return_score')) {
|
||||||
// remove the public texture from all users' closet
|
if ($u = $users->get($result->uploader)) {
|
||||||
if ($result->public == 1) {
|
if ($result->public == 1) {
|
||||||
$users->get($result->uploader)->setScore(
|
$u->setScore(
|
||||||
$result->size * option('score_per_storage'), 'plus'
|
$result->size * option('score_per_storage'), 'plus'
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
foreach (Closet::all() as $closet) {
|
$u->setScore(
|
||||||
if ($closet->has($result->tid)) {
|
$result->size * option('private_score_per_storage'), 'plus'
|
||||||
$closet->remove($result->tid);
|
);
|
||||||
|
|
||||||
$users->get($closet->uid)->setScore(
|
|
||||||
option('score_per_closet_item'), 'plus'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$users->get($result->uploader)->setScore(
|
|
||||||
$result->size * option('private_score_per_storage'), 'plus'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,16 +255,7 @@ class SkinlibController extends Controller
|
|||||||
$player->setTexture(["tid_$type" => 0]);
|
$player->setTexture(["tid_$type" => 0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (Closet::all() as $closet) {
|
@$users->get($t->uploader)->setScore($score_diff, 'plus');
|
||||||
if ($closet->uid != $uid && $closet->has($t->tid)) {
|
|
||||||
$closet->remove($t->tid);
|
|
||||||
if (option('return_score')) {
|
|
||||||
$users->get($closet->uid)->setScore(option('score_per_closet_item'), 'plus');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$users->get($t->uploader)->setScore($score_diff, 'plus');
|
|
||||||
|
|
||||||
if ($t->setPrivacy(!$t->public)) {
|
if ($t->setPrivacy(!$t->public)) {
|
||||||
return json([
|
return json([
|
||||||
|
@ -55,10 +55,28 @@ class Closet
|
|||||||
));
|
));
|
||||||
|
|
||||||
// traverse items in the closet
|
// traverse items in the closet
|
||||||
$this->textures->filter(function ($texture) {
|
$this->textures->filter(function ($texture) use ($uid) {
|
||||||
return is_null(Texture::find($texture['tid']));
|
$t = Texture::find($texture['tid']);
|
||||||
})->each(function ($tid) {
|
|
||||||
$this->remove($tid);
|
// if the texture was deleted
|
||||||
|
if (is_null($t)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($t->public == 0 && $t->uploader != $uid) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
})->each(function ($texture) use ($uid) {
|
||||||
|
// return scores if the texture was deleted or set as private
|
||||||
|
if (option('return_score')) {
|
||||||
|
app('users')->get($uid)->setScore(
|
||||||
|
option('score_per_closet_item'), 'plus'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->remove($texture['tid']);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user