Warn newer creators that uploads go through review first.
Show a level-based notice on /upload without revealing the internal approved-artwork threshold, and mention the usual 48-hour review window.
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use App\Models\Artwork;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Inertia\Testing\AssertableInertia as Assert;
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
it('warns newer creators on the upload page without revealing the internal threshold', function (): void {
|
||||
$user = User::factory()->create([
|
||||
'role' => 'user',
|
||||
'level' => 1,
|
||||
'created_at' => now()->subYear(),
|
||||
]);
|
||||
|
||||
$this->actingAs($user)
|
||||
->get('/upload')
|
||||
->assertOk()
|
||||
->assertInertia(fn (Assert $page) => $page
|
||||
->component('Upload/Index')
|
||||
->where('requires_upload_review', true)
|
||||
->missing('approved_uploads')
|
||||
->missing('reasons'))
|
||||
->assertDontSee('insufficient_approved_uploads', false)
|
||||
->assertDontSee('minimum_approved_uploads', false);
|
||||
});
|
||||
|
||||
it('does not show the new-creator review warning for trusted uploaders', function (): void {
|
||||
$user = User::factory()->create([
|
||||
'role' => 'user',
|
||||
'level' => 1,
|
||||
'created_at' => now()->subYear(),
|
||||
]);
|
||||
|
||||
Artwork::factory()->for($user)->count(5)->create([
|
||||
'is_approved' => true,
|
||||
'is_public' => true,
|
||||
'artwork_status' => 'published',
|
||||
'published_at' => now()->subDay(),
|
||||
'approval_source' => null,
|
||||
]);
|
||||
|
||||
$this->actingAs($user)
|
||||
->get('/upload')
|
||||
->assertOk()
|
||||
->assertInertia(fn (Assert $page) => $page
|
||||
->component('Upload/Index')
|
||||
->where('requires_upload_review', false));
|
||||
});
|
||||
|
||||
it('does not show the new-creator review warning for admins', function (): void {
|
||||
$admin = User::factory()->create(['role' => 'admin']);
|
||||
|
||||
$this->actingAs($admin)
|
||||
->get('/upload')
|
||||
->assertOk()
|
||||
->assertInertia(fn (Assert $page) => $page
|
||||
->component('Upload/Index')
|
||||
->where('requires_upload_review', false));
|
||||
});
|
||||
Reference in New Issue
Block a user