Skip to content

Commit d61ef90

Browse files
committed
Bug in new ticket notification with mail queue: A variable from a view composer was used in mail template. With queue:work they aren't loaded.
1 parent a08a838 commit d61ef90

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/Controllers/NotificationsController.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use PanicHD\PanicHD\Helpers\LaravelVersion;
99
use PanicHD\PanicHD\Models\Category;
1010
use PanicHD\PanicHD\Models\Comment;
11+
use PanicHD\PanicHD\Models\Member;
1112
use PanicHD\PanicHD\Models\Setting;
1213
use PanicHD\PanicHD\Models\Ticket;
1314

@@ -24,7 +25,7 @@ public function __construct(Category $category)
2425

2526
public function newTicket(Ticket $ticket)
2627
{
27-
$notification_owner = auth()->user();
28+
$notification_owner = Member::find(auth()->user()->id);
2829
$template = 'panichd::emails.new_ticket';
2930

3031
// Affects only agent notification.
@@ -33,6 +34,7 @@ public function newTicket(Ticket $ticket)
3334
$data = [
3435
'ticket' => serialize($ticket),
3536
'notification_owner' => serialize($notification_owner),
37+
'current_level' => $notification_owner->currentLevel()
3638
];
3739

3840
// Notificate assigned agent

src/Views/emails/new_ticket.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
@extends($email)
77

88
@section('content')
9-
@if ($u->currentLevel() > 1)
9+
@if ($current_level > 1)
1010
<p>{!! trans('panichd::email/globals.agent_new_ticket', ['agent' => $notification_owner->name]) !!}</p>
1111
@else
1212
<p>{!! trans('panichd::email/globals.user_new_ticket', ['user' => $notification_owner->name]) !!}</p>

0 commit comments

Comments
 (0)