Implement ticket links and blocker state

This commit is contained in:
2026-03-25 09:12:17 +01:00
parent 3b31e6bb7d
commit 70b90f32d4
34 changed files with 1722 additions and 10 deletions
@@ -18,9 +18,12 @@ class UpdateProjectTicket
/**
* @param array{
* acceptance_criteria: string|null,
* blocked_comment: string|null,
* description: string|null,
* is_blocked: bool,
* ticket_priority_id: int,
* ticket_type_id: int,
* parent_ticket_id: int|null,
* title: string
* } $ticketAttributes
* @param array<int, array{
@@ -36,6 +39,10 @@ class UpdateProjectTicket
array $fieldValueAttributes,
): bool {
return DB::transaction(function () use ($actor, $fieldValueAttributes, $ticket, $ticketAttributes): bool {
if (! $ticketAttributes['is_blocked']) {
$ticketAttributes['blocked_comment'] = null;
}
$ticket->loadMissing([
'fieldValues.ticketFieldDefinition',
'fieldValues.userValue',
@@ -88,6 +95,14 @@ class UpdateProjectTicket
$ticket->acceptance_criteria,
$ticketAttributes['acceptance_criteria'],
);
$this->trackScalarChange(
$changes,
$summaryLabels,
'blocked_comment',
'blocker comment',
$ticket->blocked_comment,
$ticketAttributes['blocked_comment'],
);
if ($ticket->ticket_type_id !== $ticketAttributes['ticket_type_id']) {
$changes['ticket_type'] = [
@@ -105,6 +120,14 @@ class UpdateProjectTicket
$summaryLabels[] = 'priority';
}
if ($ticket->is_blocked !== $ticketAttributes['is_blocked']) {
$changes['is_blocked'] = [
'from' => $ticket->is_blocked,
'to' => $ticketAttributes['is_blocked'],
];
$summaryLabels[] = 'blocked state';
}
if ($ticket->parent_ticket_id !== $ticketAttributes['parent_ticket_id']) {
$newParentTicket = $ticketAttributes['parent_ticket_id'] === null
? null