From 96e4bf0c61019a5dabb28c68b1b2553e46ef2e9c Mon Sep 17 00:00:00 2001 From: Taslan Graham Date: Fri, 29 Nov 2024 15:47:52 -0500 Subject: [PATCH] pkp/pkp-lib#10636 update notifications on submission submit --- api/v1/submissions/PKPSubmissionHandler.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/api/v1/submissions/PKPSubmissionHandler.php b/api/v1/submissions/PKPSubmissionHandler.php index a84a04ee6fc..e635f4e0aa2 100644 --- a/api/v1/submissions/PKPSubmissionHandler.php +++ b/api/v1/submissions/PKPSubmissionHandler.php @@ -587,21 +587,21 @@ public function edit(SlimRequest $slimRequest, APIResponse $response, array $arg if (isset($parsedBody)){ $params = $this->convertStringsToSchema(PKPSchemaService::SCHEMA_SUBMISSION, $parsedBody); - + $readOnlyErrors = $this->getWriteDisabledErrors(PKPSchemaService::SCHEMA_SUBMISSION, $params); if (!empty($readOnlyErrors)) { return $response->withStatus(400)->withJson($readOnlyErrors); } - + $params['id'] = $submission->getId(); $params['contextId'] = $request->getContext()->getId(); - + $errors = Repo::submission()->validate($submission, $params, $request->getContext()); - + if (!empty($errors)) { return $response->withStatus(400)->withJson($errors); } - + Repo::submission()->edit($submission, $params); } @@ -743,6 +743,16 @@ public function submit(SlimRequest $slimRequest, APIResponse $response, array $a Repo::eventLog()->add($eventLog); } + + $notificationManager = new NotificationManager(); + $notificationManager->updateNotification( + Application::get()->getRequest(), + [PKPNotification::NOTIFICATION_TYPE_APPROVE_SUBMISSION], + null, + PKPApplication::ASSOC_TYPE_SUBMISSION, + $submission->getId() + ); + $userGroups = Repo::userGroup() ->getCollector() ->filterByContextIds([$context->getId()])