Add ticket status changed notification dispatch
This commit is contained in:
@@ -2,16 +2,20 @@
|
||||
|
||||
namespace App\Actions\Tickets;
|
||||
|
||||
use App\Actions\Notifications\BuildTicketStatusChangedPayload;
|
||||
use App\Actions\Notifications\TicketStatusChanged;
|
||||
use App\Enums\TicketWorklogEntryType;
|
||||
use App\Models\Project;
|
||||
use App\Models\Ticket;
|
||||
use App\Models\TicketStatus;
|
||||
use App\Models\User;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class MoveProjectTicket
|
||||
{
|
||||
public function __construct(
|
||||
private readonly BuildTicketStatusChangedPayload $buildTicketStatusChangedPayload,
|
||||
private readonly CreateTicketWorklogEntry $createTicketWorklogEntry,
|
||||
) {}
|
||||
|
||||
@@ -44,6 +48,8 @@ class MoveProjectTicket
|
||||
'ticket_status_id' => $destinationStatus->id,
|
||||
]);
|
||||
|
||||
$occurredAt = CarbonImmutable::now();
|
||||
|
||||
$this->createTicketWorklogEntry->handle(
|
||||
$ticket->fresh(),
|
||||
$user,
|
||||
@@ -61,6 +67,19 @@ class MoveProjectTicket
|
||||
],
|
||||
);
|
||||
|
||||
TicketStatusChanged::dispatch(
|
||||
$this->buildTicketStatusChangedPayload->handle(
|
||||
$project,
|
||||
$ticket,
|
||||
$user,
|
||||
$originStatusId,
|
||||
$originLabel,
|
||||
$destinationStatus,
|
||||
$destinationLabel,
|
||||
$occurredAt,
|
||||
),
|
||||
);
|
||||
|
||||
return [
|
||||
'destination_label' => $destinationLabel,
|
||||
'moved' => true,
|
||||
|
||||
Reference in New Issue
Block a user