Skip to content

Commit d709eb6

Browse files
committed
#11912 Creator won't exist if task is automatically created
1 parent 1ca1a2b commit d709eb6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

api/v1/submissions/tasks/formRequests/EditTask.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ function (string $attribute, array $value, Closure $fail) {
165165
// Check if the task creator is among participants
166166
function (string $attribute, array $value, Closure $fail) {
167167
$participantIds = Arr::pluck($this->input('participants'), 'userId');
168+
$creatorId = $this->getCreatorId();
169+
170+
if ($creatorId === null) {
171+
return true; // We allow absent creator when task is automatically created
172+
}
173+
168174
if (!in_array($this->getCreatorId(), $participantIds)) {
169175
return $fail(__('submission.task.validation.error.participant.creator'));
170176
}
@@ -274,7 +280,7 @@ protected function getStageId(): int
274280
return $this->task->stageId;
275281
}
276282

277-
protected function getCreatorId(): int
283+
protected function getCreatorId(): ?int
278284
{
279285
return $this->task->createdBy;
280286
}

0 commit comments

Comments
 (0)