Skip to content

Commit 4cf503e

Browse files
simonhampclaude
andcommitted
Remove hardcoded support-tickets path prefix from file storage
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c2c8d80 commit 4cf503e

4 files changed

Lines changed: 9 additions & 9 deletions

File tree

app/Filament/Resources/SupportTicketResource/Widgets/TicketRepliesWidget.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function sendReply(): void
4343
$attachments = [];
4444

4545
foreach ($this->replyAttachments as $file) {
46-
$path = $file->store("support-tickets/{$this->record->mask}/replies", 'support-tickets');
46+
$path = $file->store("{$this->record->mask}/replies", 'support-tickets');
4747

4848
$attachments[] = [
4949
'name' => $file->getClientOriginalName(),

app/Livewire/Customer/Support/Create.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public function submit(): void
151151
$attachments = [];
152152

153153
foreach ($this->uploads as $file) {
154-
$path = $file->store("support-tickets/{$ticket->mask}", 'support-tickets');
154+
$path = $file->store($ticket->mask, 'support-tickets');
155155

156156
$attachments[] = [
157157
'name' => $file->getClientOriginalName(),

app/Livewire/Customer/Support/Show.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function reply(): void
6363
$attachments = [];
6464

6565
foreach ($this->replyAttachments as $file) {
66-
$path = $file->store("support-tickets/{$this->supportTicket->mask}/replies", 'support-tickets');
66+
$path = $file->store("{$this->supportTicket->mask}/replies", 'support-tickets');
6767

6868
$attachments[] = [
6969
'name' => $file->getClientOriginalName(),

tests/Feature/SupportTicketTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,11 +1519,11 @@ public function ticket_owner_can_download_ticket_attachment(): void
15191519
$ticket = SupportTicket::factory()->create([
15201520
'user_id' => $user->id,
15211521
'attachments' => [
1522-
['name' => 'test.png', 'path' => 'support-tickets/ticket_123/abc.png', 'size' => 1000, 'mime_type' => 'image/png'],
1522+
['name' => 'test.png', 'path' => 'ticket_123/abc.png', 'size' => 1000, 'mime_type' => 'image/png'],
15231523
],
15241524
]);
15251525

1526-
Storage::disk('support-tickets')->put('support-tickets/ticket_123/abc.png', 'fake content');
1526+
Storage::disk('support-tickets')->put('ticket_123/abc.png', 'fake content');
15271527

15281528
$response = $this->actingAs($user)
15291529
->get(route('customer.support.tickets.attachment', [$ticket, 0]));
@@ -1542,7 +1542,7 @@ public function other_user_cannot_download_ticket_attachment(): void
15421542
$ticket = SupportTicket::factory()->create([
15431543
'user_id' => $owner->id,
15441544
'attachments' => [
1545-
['name' => 'test.png', 'path' => 'support-tickets/ticket_123/abc.png', 'size' => 1000, 'mime_type' => 'image/png'],
1545+
['name' => 'test.png', 'path' => 'ticket_123/abc.png', 'size' => 1000, 'mime_type' => 'image/png'],
15461546
],
15471547
]);
15481548

@@ -1567,11 +1567,11 @@ public function admin_can_download_ticket_attachment(): void
15671567
$ticket = SupportTicket::factory()->create([
15681568
'user_id' => $user->id,
15691569
'attachments' => [
1570-
['name' => 'test.png', 'path' => 'support-tickets/ticket_123/abc.png', 'size' => 1000, 'mime_type' => 'image/png'],
1570+
['name' => 'test.png', 'path' => 'ticket_123/abc.png', 'size' => 1000, 'mime_type' => 'image/png'],
15711571
],
15721572
]);
15731573

1574-
Storage::disk('support-tickets')->put('support-tickets/ticket_123/abc.png', 'fake content');
1574+
Storage::disk('support-tickets')->put('ticket_123/abc.png', 'fake content');
15751575

15761576
$response = $this->actingAs($admin)
15771577
->get(route('customer.support.tickets.attachment', [$ticket, 0]));
@@ -1588,7 +1588,7 @@ public function invalid_attachment_index_returns_404(): void
15881588
$ticket = SupportTicket::factory()->create([
15891589
'user_id' => $user->id,
15901590
'attachments' => [
1591-
['name' => 'test.png', 'path' => 'support-tickets/ticket_123/abc.png', 'size' => 1000, 'mime_type' => 'image/png'],
1591+
['name' => 'test.png', 'path' => 'ticket_123/abc.png', 'size' => 1000, 'mime_type' => 'image/png'],
15921592
],
15931593
]);
15941594

0 commit comments

Comments
 (0)