Skip to content

Commit dafd8a4

Browse files
committed
pkp#10263 Follow-up to clean up canEditPublication method per review feedback from PR#11225
1 parent d859cc6 commit dafd8a4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

classes/submission/Repository.php

+6-5
Original file line numberDiff line numberDiff line change
@@ -520,16 +520,17 @@ public function canEditPublication(int $submissionId, int $userId): bool
520520

521521
$submission = $this->get($submissionId);
522522
// any published or scheduled then probe
523-
$hasLockedPublication = $submission
524-
&& $submission->getData('publications')
525-
->contains(fn($p) =>
523+
$hasLockedPublication = $submission?->getData('publications')
524+
?->contains(
525+
/** @var Publication $p */
526+
fn ($p) =>
526527
in_array(
527528
$p->getData('status'),
528529
[Submission::STATUS_PUBLISHED, Submission::STATUS_SCHEDULED]
529530
)
530-
);
531+
);
531532

532-
if ($hasLockedPublication && !$assignments->contains(fn($sa) => $sa->userGroup && $sa->userGroup->roleId !== Role::ROLE_ID_AUTHOR)) {
533+
if ($hasLockedPublication && !$assignments->contains(fn($sa) => $sa->userGroup && $sa->userGroup->roleId != Role::ROLE_ID_AUTHOR)) {
533534
return false;
534535
}
535536

0 commit comments

Comments
 (0)