Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OJS 3.4] Reviewer invitation email not available anymore in Submission Activity Logs #9795

Open
pilasou opened this issue Mar 13, 2024 · 13 comments
Assignees
Milestone

Comments

@pilasou
Copy link

pilasou commented Mar 13, 2024

Describe the bug
When inviting a new user to review a submission, a new entry with a copy of the email sent used to be added in the submission Activity Logs. Starting with 3.4, this is no longer the case. This is a major problem if the configuration "One-click Reviewer Access" is used as the Activity Logs emails copy was the only place editors can get the one click URL sent to the reviewer.

To Reproduce
Steps to reproduce the behavior:

  1. Go to a submission at the Review Stage
  2. Invite a new reviewer to the submission (Add reviewer button)
  3. In the invitation window, ensure that the option "Do not send email to Reviewer." is unchecked
  4. Confirm by clicking on the Add reviewer button
  5. Got the the activtiy log (clic on the Activity log Button on the top left of the page)
  6. In the activity log window, the email sent to the reviewer is not available. It only contains an entry confirming the invitation of the reviewer.

The line that used to be in the Activity Log for reviewer invitation email was the following one :

image

What application are you using?
OJS 3.4.0.4 also tested on 3.4.0.5

@asmecher
Copy link
Member

The editors intentionally shouldn't be able to get the one-click emails -- in previous releases this was intentionally prevented. We'll be using more invitation tools in the future that similarly will be designed to avoid letting the editor fully "impersonate" the user without some kind of indication that's what happened. Can you describe your use case a little more?

@geniusdesignbrasil
Copy link

Hi,

I have a similar issue after upgrading fron 3.3.0-14 to 3.4.0-5. Email text log is not registered on Activity history on 3.4 version.

Even when the email is correctly sent, the email text log is not registered on activity history. Is this a new behavior on 3.4 version or is this an issue?

ojs-issue

@asmecher asmecher added this to the 3.4.0-6 milestone Apr 2, 2024
@asmecher
Copy link
Member

asmecher commented Apr 2, 2024

@Vitaliy-1, could you have a look at this one?

@ULP-SLO
Copy link

ULP-SLO commented Apr 22, 2024

We have exactly the same situation. When a reviewer is assigned, they receive the e-mail invitation, but email does not show up in the activity log. When I send an individual email to the reviewer as editor, we can see the email history in the activity log.

image

We are using OJS 3.4.0.5.

@kerimsarigul
Copy link

Is there any possibility to solve this problem before the new version is released?

@ULP-SLO
Copy link

ULP-SLO commented Jun 13, 2024

We later realised that the subject of the OJS e-mail subject was too long. It automatically contains the title and subtitle of the submission as well as other information. The limit for the e-mail subject was set to 255, we changed it to 988 and now it's fine.

@kerimsarigul
Copy link

On which table did you make this change?

@temin
Copy link
Contributor

temin commented Jun 14, 2024

I made changes to table 'email_log'. More details in #10020

@kerimsarigul
Copy link

I made changes to table 'email_log'. More details in #10020

This method did not solve my problem.
When a reviewer is assigned, they receive the email invitation, but the email does not appear in the activity log.
image

this is a same issue I think #9991

@jim13731
Copy link

jim13731 commented Jul 5, 2024

@Vitaliy-1 Thank you for the sharing the files path.

I have added functionality to log email data for the "Add Reviewer" action in OJS 3.4. Below are the changes made:

Files Modified
lib/pkp/classes/log/event/PKPSubmissionEventLogEntry.php
lib/pkp/classes/submission/action/EditorAction.php

Changes

  1. lib/pkp/classes/log/event/PKPSubmissionEventLogEntry.php

Added new constants for email events:

`class PKPSubmissionEventLogEntry extends EventLogEntry
{
// ... existing constants ...

public const SUBMISSION_EMAIL_REVIEW_REQUEST = 0x50000001;
public const SUBMISSION_EMAIL_REVIEW_REQUEST_SUBSEQUENT = 0x50000002;

// ... existing methods ...

}
`
2. lib/pkp/classes/submission/action/EditorAction.php

Modified the addReviewer method to include email logging:

`public function addReviewer($request, $submission, $reviewerId, &$reviewRound, $reviewDueDate, $responseDueDate, $reviewMethod = null)
{
// ... existing code ...

if (!$assigned && isset($reviewer) && !Hook::call('EditorAction::addReviewer', [&$submission, $reviewerId])) {
    // ... existing code ...

    // Send mail
    if (!$request->getUserVar('skipEmail')) {
        $context = PKPServices::get('context')->get($submission->getData('contextId'));
        $emailTemplate = Repo::emailTemplate()->getByKey($submission->getData('contextId'), $request->getUserVar('template'));
        $emailBody = $request->getUserVar('personalMessage');
        $emailSubject = $emailTemplate->getLocalizedData('subject');
        $mailable = $this->createMail($submission, $reviewAssignment, $reviewer, $user, $emailBody, $emailSubject, $context);

        try {
            Mail::send($mailable);

            // Log email
            $eventType = ($reviewRound->getRound() == 1) ? PKPSubmissionEventLogEntry::SUBMISSION_EMAIL_REVIEW_REQUEST : PKPSubmissionEventLogEntry::SUBMISSION_EMAIL_REVIEW_REQUEST_SUBSEQUENT;
            $submissionEmailLogDao = DAORegistry::getDAO('SubmissionEmailLogDAO');
            $submissionEmailLogDao->logMailable($eventType, $mailable, $submission, $user);

        } catch (TransportException $e) {
            $notificationMgr = new PKPNotificationManager();
            $notificationMgr->createTrivialNotification(
                $user->getId(),
                PKPNotification::NOTIFICATION_TYPE_ERROR,
                ['contents' => __('email.compose.error')]
            );
            trigger_error('Failed to send email: ' . $e->getMessage(), E_USER_WARNING);
        }
    }
}

}

Summary

These changes ensure that email data is logged whenever a reviewer is added.`

image

image

@kerimsarigul
Copy link

Thanks @jim13731
These changes solved my problem.

@asmecher
Copy link
Member

asmecher commented Jul 5, 2024

Hi @jim13731! Would you be able to open a pull request proposing those changes, and link add a link to the pull request here? That way we can review it for possible inclusion in the next release.

@asmecher asmecher modified the milestones: 3.4.0-6, 3.4.0-7 Jul 19, 2024
@asmecher asmecher modified the milestones: 3.4.0-7, 3.4.0-8 Aug 23, 2024
@pilasou
Copy link
Author

pilasou commented Oct 30, 2024

Hi everyone, we have tried the code shared in the comment: #9795 (comment) on our test instance and it worked. The email is added to the Activity log of the submission:
image

@jim13731 will you be making a official PR for this code? I think this is the only way for it to be officialy part of OJS. Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants