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:
test
2026-09-20 14:49:06 +02:00
parent 5437f84c4c
commit 366dbf1de8
14 changed files with 1175 additions and 70 deletions
+54
View File
@@ -359,6 +359,60 @@ final class NotificationService
]);
}
public function notifyArtworkApproved(User $recipient, User $actor, \App\Models\Artwork $artwork): ?Notification
{
if ($recipient->id === $actor->id) {
return null;
}
$title = (string) ($artwork->title ?: 'Untitled artwork');
return Notification::query()->create([
'user_id' => (int) $recipient->id,
'type' => 'artwork_approved',
'data' => [
'type' => 'artwork_approved',
'actor_id' => (int) $actor->id,
'actor_name' => $actor->name,
'actor_username' => $actor->username,
'message' => 'Your artwork "'.$title.'" was approved and is now live.',
'url' => route('art.show', ['id' => $artwork->id, 'slug' => $artwork->slug ?: $artwork->id]),
'artwork_id' => (int) $artwork->id,
'artwork_title' => $title,
],
]);
}
public function notifyArtworkRejected(User $recipient, User $actor, \App\Models\Artwork $artwork, ?string $note = null): ?Notification
{
if ($recipient->id === $actor->id) {
return null;
}
$title = (string) ($artwork->title ?: 'Untitled artwork');
$message = 'Your artwork "'.$title.'" was not approved.';
$note = trim((string) $note);
if ($note !== '') {
$message .= ' Reason: '.$note;
}
return Notification::query()->create([
'user_id' => (int) $recipient->id,
'type' => 'artwork_rejected',
'data' => [
'type' => 'artwork_rejected',
'actor_id' => (int) $actor->id,
'actor_name' => $actor->name,
'actor_username' => $actor->username,
'message' => $message,
'url' => route('studio.artworks.edit', ['id' => $artwork->id]),
'artwork_id' => (int) $artwork->id,
'artwork_title' => $title,
'note' => $note !== '' ? $note : null,
],
]);
}
public function notifyGroupPostPublished(User $recipient, User $actor, \App\Models\Group $group, \App\Models\GroupPost $post): ?Notification
{
if ($recipient->id === $actor->id) {