Save workspace changes

This commit is contained in:
2026-04-18 17:02:56 +02:00
parent f02ea9a711
commit 87d60af5a9
4220 changed files with 1388603 additions and 1554 deletions

View File

@@ -0,0 +1,67 @@
<?php
declare(strict_types=1);
use App\Models\DashboardPreference;
use App\Models\User;
it('persists sanitized pinned dashboard spaces for the authenticated user', function () {
$user = User::factory()->create([
'email_verified_at' => now(),
]);
$response = $this->actingAs($user)->putJson('/api/dashboard/preferences/shortcuts', [
'pinned_spaces' => [
'/dashboard/notifications',
'/dashboard/notifications',
'/dashboard/comments/received',
'/not-allowed',
'/studio',
],
]);
$response
->assertOk()
->assertJson([
'data' => [
'pinned_spaces' => [
'/dashboard/notifications',
'/dashboard/comments/received',
'/studio',
],
],
]);
expect(DashboardPreference::query()->find($user->id)?->pinned_spaces)->toBe([
'/dashboard/notifications',
'/dashboard/comments/received',
'/studio',
]);
});
it('allows clearing all pinned dashboard spaces for the authenticated user', function () {
$user = User::factory()->create([
'email_verified_at' => now(),
]);
DashboardPreference::query()->create([
'user_id' => $user->id,
'pinned_spaces' => [
'/dashboard/notifications',
],
]);
$response = $this->actingAs($user)->putJson('/api/dashboard/preferences/shortcuts', [
'pinned_spaces' => [],
]);
$response
->assertOk()
->assertJson([
'data' => [
'pinned_spaces' => [],
],
]);
expect(DashboardPreference::query()->find($user->id)?->pinned_spaces)->toBe([]);
});