feat: implement Story 2.4 — Dashboard Activity Feed with review fixes
Add role-scoped activity feed to the dashboard showing the 20 most recent workspace events. Owners/Managers see all activity (declarations, clients, team changes); Workers see only their assigned declarations. Includes French descriptions, relative timestamps, responsive layout (desktop sidebar, tablet inline, mobile collapsible), and 7 passing Pest tests. Review fixes applied: batch-load declarations/clients/users to eliminate N+1 queries, consistent soft-delete handling in URL resolution, French grammar singular/plural fix, missing icon map entry, and corrected tablet breakpoint per spec. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -267,6 +267,23 @@ test('owner and manager dashboard returns isWorker false', function () {
|
||||
);
|
||||
});
|
||||
|
||||
test('worker without workspace session gets isWorker false in fallback', function () {
|
||||
$worker = User::factory()->create();
|
||||
$workspace = Workspace::factory()->create();
|
||||
$workspace->users()->attach($worker->id, ['role' => 'worker']);
|
||||
|
||||
// No session(['current_workspace_id' => ...]) — simulate no active workspace
|
||||
$this->actingAs($worker);
|
||||
$response = $this->get(route('dashboard'));
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertInertia(fn ($page) => $page
|
||||
->component('Dashboard')
|
||||
->where('isWorker', false)
|
||||
->where('workspaceName', null)
|
||||
);
|
||||
});
|
||||
|
||||
test('cached data is scoped per user with worker cache key including user id', function () {
|
||||
[$worker, $workspace, $client] = setupWorkerWorkspace();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user