fixed ticket display

This commit is contained in:
Mark Gregory
2026-06-22 11:37:36 +01:00
parent 95f29457d8
commit de336c219d
2 changed files with 19 additions and 11 deletions
+4 -10
View File
@@ -316,21 +316,15 @@ final class TicketShow extends Component
]) ?? $ticket;
$this->hydrateTicketUsers($ticket);
$comments = Comment::query()
->where('ticket_id', $ticket->id)
->when(Schema::hasColumn('helpdesk_comments', 'deleted_at'), static function ($query): void {
$query->whereNull('deleted_at');
})
->when(Schema::hasColumn('helpdesk_comments', 'tombstoned_at'), static function ($query): void {
$query->whereNull('tombstoned_at');
})
$comments = $ticket->comments()
->active()
->when(! $this->canSeeInternalNotes(), static function ($query): void {
$query->where('is_internal', false);
})
->with(['user.company', 'attachments'])
->with(['user.company', 'attachments', 'replies.user.company', 'replies.attachments'])
->oldest()
->get();
$ticket->setRelation('comments', $comments);
$ticket->setAttribute('public_replies_count', $comments->where('is_internal', false)->count());
$ticket->setAttribute('time_spent_minutes', $this->sumCommentMinutes($comments));