Require review for untrusted accounts, add admin artwork review APIs, and keep queued or auto-trusted publishes from counting as established history.
40 lines
1.2 KiB
PHP
40 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Notifications;
|
|
|
|
use App\Models\Artwork;
|
|
use App\Models\User;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
final class NewArtworkReviewNotification extends Notification implements ShouldQueue
|
|
{
|
|
use Queueable;
|
|
|
|
public function __construct(
|
|
private readonly Artwork $artwork,
|
|
private readonly User $uploader,
|
|
private readonly array $reasons,
|
|
) {}
|
|
|
|
public function via(object $notifiable): array
|
|
{
|
|
return ['mail'];
|
|
}
|
|
|
|
public function toMail(object $notifiable): MailMessage
|
|
{
|
|
return (new MailMessage)
|
|
->subject('Skinbase: new artwork awaiting review')
|
|
->greeting('New artwork review')
|
|
->line(sprintf('“%s” by %s is being held before publication.', $this->artwork->title ?: 'Untitled artwork', $this->uploader->username ?: $this->uploader->name))
|
|
->line('Reasons: '.implode(', ', $this->reasons))
|
|
->action('Open moderation queue', url('/moderation/uploads'))
|
|
->line('The artwork is not public until it is approved.');
|
|
}
|
|
}
|