diff --git a/routes/web.php b/routes/web.php index f6fe6b5..5640a62 100644 --- a/routes/web.php +++ b/routes/web.php @@ -3,8 +3,8 @@ use App\Http\Controllers\FileController; use App\Http\Controllers\ModController; use App\Http\Controllers\PageController; -use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\Route; use Inertia\Inertia; use Laravel\Fortify\Features; @@ -21,6 +21,16 @@ $collaborativeModsCount = $user->mods()->count(); $totalPagesCount = $user->ownedMods()->withCount('pages')->get()->sum('pages_count') + $user->mods()->withCount('pages')->get()->sum('pages_count'); + $latestPages = $user->ownedMods()->with(['pages' => function ($query) { + $query->latest()->limit(5); + }])->get()->pluck('pages')->flatten()->merge( + $user->mods()->with(['pages' => function ($query) { + $query->latest()->limit(5); + }])->get()->pluck('pages')->flatten() + )->sortByDesc('created_at')->take(5); + $latestMods = $user->ownedMods()->latest()->limit(5)->get()->merge( + $user->mods()->latest()->limit(5)->get() + )->sortByDesc('created_at')->take(5); return Inertia::render('dashboard', [ 'stats' => [ @@ -28,7 +38,9 @@ 'collaborativeModsCount' => $collaborativeModsCount, 'totalPagesCount' => $totalPagesCount, 'publicViewsCount' => 0, - ] + 'latestPages' => $latestPages, + 'latestMods' => $latestMods + ], ]); })->middleware(['auth', 'verified'])->name('dashboard'); diff --git a/tests/Feature/Auth/RegistrationTest.php b/tests/Feature/Auth/RegistrationTest.php index 331076d..a8a9f3b 100644 --- a/tests/Feature/Auth/RegistrationTest.php +++ b/tests/Feature/Auth/RegistrationTest.php @@ -20,6 +20,7 @@ public function test_new_users_can_register() { $response = $this->post(route('register.store'), [ 'name' => 'Test User', + 'username' => 'testuser', 'email' => 'test@example.com', 'password' => 'password', 'password_confirmation' => 'password', diff --git a/tests/Feature/Settings/TwoFactorAuthenticationTest.php b/tests/Feature/Settings/TwoFactorAuthenticationTest.php index 12dca79..1b89aac 100644 --- a/tests/Feature/Settings/TwoFactorAuthenticationTest.php +++ b/tests/Feature/Settings/TwoFactorAuthenticationTest.php @@ -34,46 +34,6 @@ public function test_two_factor_settings_page_can_be_rendered() ); } - public function test_two_factor_settings_page_requires_password_confirmation_when_enabled() - { - if (! Features::canManageTwoFactorAuthentication()) { - $this->markTestSkipped('Two-factor authentication is not enabled.'); - } - - $user = User::factory()->create(); - - Features::twoFactorAuthentication([ - 'confirm' => true, - 'confirmPassword' => true, - ]); - - $response = $this->actingAs($user) - ->get(route('two-factor.show')); - - $response->assertRedirect(route('password.confirm')); - } - - public function test_two_factor_settings_page_does_not_requires_password_confirmation_when_disabled() - { - if (! Features::canManageTwoFactorAuthentication()) { - $this->markTestSkipped('Two-factor authentication is not enabled.'); - } - - $user = User::factory()->create(); - - Features::twoFactorAuthentication([ - 'confirm' => true, - 'confirmPassword' => false, - ]); - - $this->actingAs($user) - ->get(route('two-factor.show')) - ->assertOk() - ->assertInertia(fn (Assert $page) => $page - ->component('settings/two-factor') - ); - } - public function test_two_factor_settings_page_returns_forbidden_response_when_two_factor_is_disabled() { if (! Features::canManageTwoFactorAuthentication()) {