From 3e5878192eee7b42c82834e980c62615b80bda4a Mon Sep 17 00:00:00 2001 From: mrKamoo Date: Mon, 24 Aug 2026 07:50:17 +0200 Subject: [PATCH] =?UTF-8?q?Exclut=20les=20sch=C3=A9mas=20draw.io=20du=20na?= =?UTF-8?q?vigateur=20Documents?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Les schémas créés depuis la section Infrastructure sont stockés comme des Document (type=diagram) pour réutiliser le versioning existant, mais ne doivent apparaître que dans leur propre section, pas mélangés aux fichiers du module Documents. Co-Authored-By: Claude Sonnet 5 --- .../components/documents/⚡index.blade.php | 1 + tests/Feature/InfrastructureTest.php | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/resources/views/components/documents/⚡index.blade.php b/resources/views/components/documents/⚡index.blade.php index 6c189e9..21874bc 100644 --- a/resources/views/components/documents/⚡index.blade.php +++ b/resources/views/components/documents/⚡index.blade.php @@ -206,6 +206,7 @@ new class extends Component 'breadcrumbs' => $breadcrumbs, 'items' => $this->organization->documents() ->where('folder_id', $this->folderId) + ->where('type', '!=', 'diagram') ->orderByDesc('is_folder') ->orderBy('name') ->get(), diff --git a/tests/Feature/InfrastructureTest.php b/tests/Feature/InfrastructureTest.php index 8026d66..943cdc9 100644 --- a/tests/Feature/InfrastructureTest.php +++ b/tests/Feature/InfrastructureTest.php @@ -72,4 +72,32 @@ class InfrastructureTest extends TestCase $this->assertSame(2, $document->current_version); $this->assertCount(2, $document->versions); } + + public function test_diagrams_do_not_appear_in_the_documents_browser(): void + { + $user = User::factory()->create(); + $org = Organization::create(['name' => 'Test Commune', 'slug' => 'test-commune', 'org_type' => 'client']); + + $org->documents()->create([ + 'name' => 'Schéma réseau - Mairie', + 'type' => 'diagram', + 'content' => '', + 'current_version' => 1, + 'created_by' => $user->id, + ]); + + $org->documents()->create([ + 'name' => 'Compte-rendu.md', + 'type' => 'markdown', + 'content' => '', + 'current_version' => 1, + 'created_by' => $user->id, + ]); + + $this->actingAs($user); + + Livewire::test('documents.index', ['organization' => $org]) + ->assertDontSee('Schéma réseau - Mairie') + ->assertSee('Compte-rendu.md'); + } }