pkp-lib icon indicating copy to clipboard operation
pkp-lib copied to clipboard

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

Open pilasou opened this issue 11 months ago • 12 comments

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

pilasou avatar Mar 13 '24 16:03 pilasou

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?

asmecher avatar Mar 21 '24 17:03 asmecher

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

geniusdesignbrasil avatar Apr 01 '24 20:04 geniusdesignbrasil

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

asmecher avatar Apr 02 '24 12:04 asmecher

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.

ULP-SLO avatar Apr 22 '24 11:04 ULP-SLO

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

kerimsarigul avatar Jun 13 '24 11:06 kerimsarigul

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.

ULP-SLO avatar Jun 13 '24 12:06 ULP-SLO

On which table did you make this change?

kerimsarigul avatar Jun 13 '24 13:06 kerimsarigul

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

temin avatar Jun 14 '24 09:06 temin

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 https://github.com/pkp/pkp-lib/issues/9991

kerimsarigul avatar Jun 14 '24 21:06 kerimsarigul

@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

jim13731 avatar Jul 05 '24 03:07 jim13731

Thanks @jim13731 These changes solved my problem.

kerimsarigul avatar Jul 05 '24 13:07 kerimsarigul

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 avatar Jul 05 '24 15:07 asmecher