Skip to content

Commit

Permalink
Merge branch 'fixEmailToAuthors340-737' into 'main'
Browse files Browse the repository at this point in the history
Corrige problema ao tentar excluir versão - 340

See merge request softwares-pkp/plugins_ojs/authorVersion!20
  • Loading branch information
JhonathanLepidus committed Jan 20, 2025
2 parents 343af22 + 88b4c36 commit c5a642e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
15 changes: 10 additions & 5 deletions api/v1/authorVersion/AuthorVersionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,18 @@ private function sendSubmittedVersionEmail($submission, $publication, $versionJu

private function sendDeletedVersionEmail($submission, $publication, $deletingJustification)
{
$authors = $publication->getData('authors');
if ($authors->isEmpty()) {
return;
}

$request = $this->getRequest();
$context = $request->getContext();

$emailTemplateKey = 'DELETED_VERSION_NOTIFICATION';
$primaryAuthor = $publication->getPrimaryAuthor();
$recipientAuthor = $publication->getPrimaryAuthor() ?? $authors->first();

$recipients = [
['email' => $primaryAuthor->getData('email'), 'name' => $primaryAuthor->getFullName()]
['email' => $recipientAuthor->getData('email'), 'name' => $recipientAuthor->getFullName()]
];

$params = ['deletingJustification' => $deletingJustification];
Expand Down Expand Up @@ -180,7 +185,7 @@ private function getManagersAssigned($publication): array
while ($assignment = $allAssignments->next()) {
$userId = $assignment->getUserId();

if($this->userIsManager($userId)) {
if ($this->userIsManager($userId)) {
$manager = Repo::user()->get($userId);
$managers[] = [
'email' => $manager->getEmail(),
Expand All @@ -200,7 +205,7 @@ private function userIsManager($userId): bool
$managerGroupName = 'preprint server manager';

foreach ($userGroupsOfUser as $userGroup) {
if(strtolower($userGroup->getName('en')) == $managerGroupName) {
if (strtolower($userGroup->getName('en')) == $managerGroupName) {
return true;
}
}
Expand Down
4 changes: 2 additions & 2 deletions version.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<version>
<application>authorVersion</application>
<type>plugins.generic</type>
<release>2.0.2.0</release>
<date>2024-08-12</date>
<release>2.0.3.0</release>
<date>2025-01-20</date>
<lazy-load>1</lazy-load>
<class>AuthorVersionPlugin</class>
</version>

0 comments on commit c5a642e

Please sign in to comment.