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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user