Add assignee changed notification event support
This commit is contained in:
@@ -17,11 +17,16 @@ final readonly class TicketStatusChangedPayload implements NotificationEventPayl
|
||||
public string $ticketUrl,
|
||||
public ?int $actorId,
|
||||
public ?string $actorName,
|
||||
public int $fromStatusId,
|
||||
public string $fromStatusLabel,
|
||||
public ?int $fromStatusId,
|
||||
public ?string $fromStatusLabel,
|
||||
public int $toStatusId,
|
||||
public string $toStatusLabel,
|
||||
public CarbonImmutable $occurredAt,
|
||||
public ?int $fromAssigneeId = null,
|
||||
public ?string $fromAssigneeName = null,
|
||||
public ?int $toAssigneeId = null,
|
||||
public ?string $toAssigneeName = null,
|
||||
public NotificationEventType $eventType = NotificationEventType::TicketStatusChanged,
|
||||
) {}
|
||||
|
||||
public function projectId(): int
|
||||
@@ -50,9 +55,11 @@ final readonly class TicketStatusChangedPayload implements NotificationEventPayl
|
||||
'$ticket_key' => $this->ticketKey,
|
||||
'$ticket_title' => $this->ticketTitle,
|
||||
'$project_name' => $this->projectName,
|
||||
'$status_from' => $this->fromStatusLabel,
|
||||
'$status_from' => $this->fromStatusLabel ?? '',
|
||||
'$status_to' => $this->toStatusLabel,
|
||||
'$actor_name' => $this->actorName ?? '',
|
||||
'$assignee_from' => $this->fromAssigneeName ?? '',
|
||||
'$assignee_to' => $this->toAssigneeName ?? '',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -62,7 +69,11 @@ final readonly class TicketStatusChangedPayload implements NotificationEventPayl
|
||||
* project: array{id: int, key: string, name: string},
|
||||
* ticket: array{id: int, key: string, title: string},
|
||||
* actor: array{id: int, name: string}|null,
|
||||
* from: array{id: int, label: string},
|
||||
* assignee: array{
|
||||
* from: array{id: int, name: string}|null,
|
||||
* to: array{id: int, name: string}|null
|
||||
* },
|
||||
* from: array{id: int, label: string}|null,
|
||||
* to: array{id: int, label: string},
|
||||
* ticket_url: string,
|
||||
* occurred_at: string
|
||||
@@ -71,7 +82,7 @@ final readonly class TicketStatusChangedPayload implements NotificationEventPayl
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'event_type' => NotificationEventType::TicketStatusChanged->value,
|
||||
'event_type' => $this->eventType->value,
|
||||
'project' => [
|
||||
'id' => $this->projectId,
|
||||
'key' => $this->projectKey,
|
||||
@@ -88,10 +99,26 @@ final readonly class TicketStatusChangedPayload implements NotificationEventPayl
|
||||
'id' => $this->actorId,
|
||||
'name' => $this->actorName,
|
||||
],
|
||||
'from' => [
|
||||
'id' => $this->fromStatusId,
|
||||
'label' => $this->fromStatusLabel,
|
||||
'assignee' => [
|
||||
'from' => $this->fromAssigneeId === null || $this->fromAssigneeName === null
|
||||
? null
|
||||
: [
|
||||
'id' => $this->fromAssigneeId,
|
||||
'name' => $this->fromAssigneeName,
|
||||
],
|
||||
'to' => $this->toAssigneeId === null || $this->toAssigneeName === null
|
||||
? null
|
||||
: [
|
||||
'id' => $this->toAssigneeId,
|
||||
'name' => $this->toAssigneeName,
|
||||
],
|
||||
],
|
||||
'from' => $this->fromStatusId === null || $this->fromStatusLabel === null
|
||||
? null
|
||||
: [
|
||||
'id' => $this->fromStatusId,
|
||||
'label' => $this->fromStatusLabel,
|
||||
],
|
||||
'to' => [
|
||||
'id' => $this->toStatusId,
|
||||
'label' => $this->toStatusLabel,
|
||||
|
||||
Reference in New Issue
Block a user