diff --git a/classes/task/ReviewReminder.php b/classes/task/ReviewReminder.php index 9de333feeb0..a3129ef0a6f 100644 --- a/classes/task/ReviewReminder.php +++ b/classes/task/ReviewReminder.php @@ -48,6 +48,7 @@ public function executeActions() ->getCollector() ->filterByIsIncomplete(true) ->orderByContextId() + ->orderBySubmissionId() ->getMany(); foreach ($incompleteAssignments as $reviewAssignment) { diff --git a/jobs/email/ReviewReminder.php b/jobs/email/ReviewReminder.php index dd861b6aff1..8d8b1a14445 100644 --- a/jobs/email/ReviewReminder.php +++ b/jobs/email/ReviewReminder.php @@ -74,13 +74,14 @@ public function handle(): void $reviewerAccessKeysEnabled = $context->getData('reviewerAccessKeysEnabled'); if ($reviewerAccessKeysEnabled) { // Give one-click access if enabled - $reviewInvitation = new ReviewerAccessInvite( - $reviewAssignment->getReviewerId(), - $context->getId(), - $reviewAssignment->getId() - ); - $reviewInvitation->setMailable($mailable); + $reviewInvitation = new ReviewerAccessInvite(); + $reviewInvitation->initialize($reviewAssignment->getReviewerId(), $context->getId(), null); + + $reviewInvitation->reviewAssignmentId = $reviewAssignment->getId(); + $reviewInvitation->updatePayload(); + $reviewInvitation->dispatch(); + $reviewInvitation->updateMailableWithUrl($mailable); } // deprecated template variables OJS 2.x diff --git a/tests/jobs/email/ReviewReminderTest.php b/tests/jobs/email/ReviewReminderTest.php index 4461f0b0f15..ebda6e33409 100644 --- a/tests/jobs/email/ReviewReminderTest.php +++ b/tests/jobs/email/ReviewReminderTest.php @@ -19,7 +19,6 @@ use PKP\submission\reviewAssignment\ReviewAssignment; use APP\submission\Repository as SubmissionRepository; use PKP\emailTemplate\Repository as EmailTemplateRepository; -use PKP\invitation\repositories\Invitation as InvitationRepository; use PKP\submission\reviewAssignment\Repository as ReviewAssignmentRepository; use PKP\log\event\Repository as EventRepository; use APP\user\Repository as UserRepository; @@ -158,7 +157,7 @@ public function register(\Pimple\Container $pimple) $emailTemplateMock = Mockery::mock(\PKP\emailTemplate\EmailTemplate::class) ->makePartial() ->shouldReceive([ - "getLocalizedData" => "" + 'getLocalizedData' => '', ]) ->withAnyArgs() ->getMock(); @@ -173,17 +172,6 @@ public function register(\Pimple\Container $pimple) app()->instance(EmailTemplateRepository::class, $emailTemplateRepoMock); - $invitationRepoMock = Mockery::mock(app(InvitationRepository::class)) - ->makePartial() - ->shouldReceive([ - 'addInvitation' => 0, - 'getMailable' => null, - ]) - ->withAnyArgs() - ->getMock(); - - app()->instance(InvitationRepository::class, $invitationRepoMock); - $eventRepoMock = Mockery::mock(app(EventRepository::class)) ->makePartial() ->shouldReceive([