Send new artwork uploads through a trust-based review policy.
Require review for untrusted accounts, add admin artwork review APIs, and keep queued or auto-trusted publishes from counting as established history.
This commit is contained in:
@@ -9,6 +9,7 @@ use App\Jobs\AutoTagArtworkJob;
|
||||
use App\Jobs\DetectArtworkMaturityJob;
|
||||
use App\Jobs\GenerateArtworkEmbeddingJob;
|
||||
use App\Models\Artwork;
|
||||
use App\Services\Moderation\ArtworkUploadPolicy;
|
||||
use App\Models\UploadBatch;
|
||||
use App\Models\UploadBatchItem;
|
||||
use App\Models\User;
|
||||
@@ -392,8 +393,24 @@ final class UploadQueueService
|
||||
}
|
||||
|
||||
$artwork = $item->artwork;
|
||||
$policy = app(ArtworkUploadPolicy::class)->assess($item->user ?? $artwork->user, $artwork);
|
||||
if ($policy['requires_review']) {
|
||||
$artwork->forceFill([
|
||||
'is_public' => false,
|
||||
'is_approved' => false,
|
||||
'artwork_status' => 'review',
|
||||
'approval_source' => null,
|
||||
'moderation_note' => implode(', ', $policy['reasons']),
|
||||
])->saveQuietly();
|
||||
$item->forceFill([
|
||||
'status' => UploadBatchItem::STATUS_NEEDS_REVIEW,
|
||||
'is_ready_to_publish' => false,
|
||||
])->save();
|
||||
return;
|
||||
}
|
||||
$artwork->forceFill([
|
||||
'is_approved' => true,
|
||||
'approval_source' => 'trusted_auto',
|
||||
'visibility' => $artwork->visibility ?: Artwork::VISIBILITY_PUBLIC,
|
||||
])->saveQuietly();
|
||||
|
||||
@@ -428,7 +445,8 @@ final class UploadQueueService
|
||||
]);
|
||||
}
|
||||
|
||||
$item->artwork->categories()->sync([$categoryId]);
|
||||
app(\App\Services\Artworks\ArtworkCategoryService::class)
|
||||
->sync($item->artwork, $categoryId, [], 'user');
|
||||
$this->refreshItem((int) $item->id);
|
||||
}
|
||||
|
||||
@@ -790,4 +808,4 @@ final class UploadQueueService
|
||||
|
||||
return $normalized === '' ? null : Str::limit($normalized, 65535, '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user