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

pkp/pkp-lib#4789 Permit declined reviews to be reinitiated #8242

Merged
merged 1 commit into from
Sep 20, 2022

Conversation

touhidurabir
Copy link
Member

This aims to provide solution to #4789

@CLAassistant
Copy link

CLAassistant commented Sep 8, 2022

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@NateWr NateWr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great @touhidurabir. I've left a few comments throughout. I've left the text review for after we resolve this question that I just added to the issue:

#4789 (comment)

We'll need to get clarity about that before we finalize this. But from a technical perspective it's looking great.

One other thing that i noticed is that when a review has been reconsidered, in the status it says "Review due: [date]" but it should say "Response due: [date]":

response-due

However, I'd suggest you not work on resolving this until we get an answer to the question in the issue. How we "fix" this will depend on how we present this feature to the editors.

$reconsiderReviewerForm = new ReconsiderRequestReviewerForm($reviewAssignment, $reviewRound, $submission);
$reconsiderReviewerForm->readInputData();

// Reinstate the reviewer and return status message
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment looks maybe out of place...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed.

if ($reconsiderReviewerForm->execute() && !$request->getUserVar('skipEmail')) {
$reviewer = Repo::user()->get($reviewAssignment->getReviewerId());
$user = $request->getUser();
$context = PKPServices::get('context')->get($submission->getData('contextId'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this happens within a grid handler that can only be accessed through a HTTP request, you can pull the context from the request: $context = $request->getContext();

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

* @class ReviewerReconsiderRequest
* @ingroup mail_mailables
*
* @brief Email sent to a declined reviewer to reconsider reviewing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Email sent to a review who has declined their review assignment to ask them
to reconsider accepting the review assignment

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

* @file classes/mail/mailables/ReviewerReconsiderRequest.php
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2000-2021 John Willinsky
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Date should be -2022. Annoying. I miss this all the time. :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.


if ( $this->getReconsiderRequested() ) {
return false;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some extra spaces around the (, ) and ! in this method.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

@@ -434,7 +436,8 @@ public function updateObject($reviewAssignment)
reminder_was_automatic = ?,
review_form_id = ?,
review_round_id = ?,
unconsidered = ?
unconsidered = ?,
reconsider_requested = ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like some old tabs in here for some reason, so there's some whitespace discrepancies.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

* @param ReviewRound $reviewRound
* @param Submission $submission
*/
public function __construct($reviewAssignment, $reviewRound, $submission)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go ahead and put the @param types into the function signature. It's hard to do with the older code in some places, but constructors are ok.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

$reviewAssignment = $this->getReviewAssignment(); /** @var ReviewAssignment $reviewAssignment */
$reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO'); /** @var ReviewAssignmentDAO $reviewAssignmentDao */

if (isset($reviewAssignment) && $reviewAssignment->getSubmissionId() == $submission->getId() && !Hook::call('EditorAction::reconsiderReviewer', [&$submission, $reviewAssignment])) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Hook here can be removed. This is part of an older pattern that we keep around for existing third-party code. But we don't need to add a new hook.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed.

$reviewAssignmentDao->updateObject($reviewAssignment);

// Stamp the modification date
$submission->stampModified();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to use stampLastActivity() here instead of stampModified(). I think we only use stampModified() for changes to the submission itself, but stampLastActivity() is for whenever activity takes place related to the submission.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

@@ -1727,6 +1727,9 @@ msgstr "Reviewer cancelled."
msgid "notification.reinstatedReviewer"
msgstr "Reviewer reinstated."

msgid "notification.requestReconsiderReviewer"
msgstr "Reviewer requested to reconsider."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request to reconsider the review assignment was sent.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

Copy link
Contributor

@NateWr NateWr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I found a couple of small things but it seems just about ready to go. 👍

@@ -278,6 +281,9 @@ msgstr "Review Submitted"
msgid "editor.review.reviewerThanked"
msgstr "Reviewer Thanked"

msgid "editor.review.ReviewerResendRequest"
msgstr "Reviewer Requested to Reconsider"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request Resent

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

"upload review files, and submit your review request.</p>"
"<p>If you have any questions, please contact me.</p>"
"<p>Kind regards,</p>"
"{$signature}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"<p>Dear {$recipientName},</p>"
"<p>Recently, you declined our request to review a submission, {$submission Title}, for {$contextName}. I'm writing to see if you are able to conduct the review after all.</p>"
"<p>We would be grateful if you're able to perform this review, but we understand if that is not possible at this time. Either way, please <a href=\"{$reviewAssignmentUrl}\">accept or decline the request</a> by {$responseDueDate}, so that we can find an alternate reviewer."
"<p>If you have any questions, please contact me.</p>"
"<p>Kind regards,</p>"
"{$signature}"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@@ -312,3 +312,17 @@ msgstr ""
"<p>If you have any questions, please contact me from your <a href=\"{$authorSubmissionUrl}\">submission dashboard</a>.</p>"
"<p>Kind regards,</p>"
"<p>{$signature}</p>"

msgid "emails.reviewResendRequest.subject"
msgstr "Can you reconsider to review for {$contextName}?"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting your review again for {$contextName}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

protected static array $fromRoleIds = [Role::ROLE_ID_MANAGER];
protected static array $toRoleIds = [Role::ROLE_ID_REVIEWER];

public function __construct(Context $context, PKPSubmission $submission, ReviewAssignment $reviewAssignment)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, the variables for the review assignment are not coming through to the email template that is loaded in the UI. I added reviewAssignmentUrl and responseDueDate to my template but they aren't rendered:

email-variables

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They were rendered correctly in the email that was sent, so I think it's only in the email preview that the variables are missing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, this is because of this code:

https://github.com/pkp/pkp-lib/blob/main/controllers/grid/users/reviewer/form/ReviewerNotifyActionForm.php#L74-L87

Vitaliy is in the process of removing the last bits of the SubmissionMailTemplate and this will probably get fixed when that is done. Can you file an issue to solve this later?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NateWr issue filed at #8262 .

@@ -1854,6 +1857,9 @@ msgstr "This review has been completed."
msgid "submission.review.status.thanked"
msgstr "This review is complete and the reviewer has been thanked for their contribution."

msgid "submission.review.status.reconsiderRequested"
msgstr "Waiting for a response from the reviewer to reconsider previously declined review request."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only shows up to a review on a submission they are assigned to. So I think we can reuse submission.review.status.awaitingResponse:

Waiting for a response from the reviewer.

From their perspective, it doesn't matter if it's a new request or a second request. Just that they need to respond.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@@ -54,6 +54,7 @@ class ReviewAssignment extends \PKP\core\DataObject
public const REVIEW_ASSIGNMENT_STATUS_COMPLETE = 8; // review has been confirmed by an editor
public const REVIEW_ASSIGNMENT_STATUS_THANKED = 9; // reviewer has been thanked
public const REVIEW_ASSIGNMENT_STATUS_CANCELLED = 10; // reviewer cancelled review request
public const REVIEW_ASSIGNMENT_STATUS_REQUEST_RESEND = 11; // requested reviewer to reconsider declined invitation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// request resent to reviewer after they declined

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done .

public function setReconsiderRequested($reconsider)
{
$this->setData('reconsider_requested', $reconsider);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rename these getter/setter methods to xxxRequestResent()?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@@ -2860,6 +2863,11 @@ msgstr ""
"This email is sent when a reviewer that was unassigned is reinstated by an "
"editor."

msgid "mailable.reviewerResendRequest.description"
msgstr ""
"This email is sent when a reviewer who has declined review invitation previously "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This email is sent by an editor to a reviewer who has declined a review request, when the editor wishes to resend the request.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@@ -1824,6 +1824,9 @@ msgstr "{$editorName} has marked the round {$round} review for submission {$subm
msgid "log.review.reviewReinstated"
msgstr "The round {$round} review by {$reviewerName} for submission {$submissionId} has been reinitiated."

msgid "log.review.reviewerResendRequest"
msgstr "The round {$round} review by {$reviewerName} for submission {$submissionId} has been requested to reconsider."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resent the request to review in round {$round} to {$reviewerName} for submission {$submissionid}.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

'stageId' => $reviewAssignment->getStageId(),
'round' => $reviewAssignment->getRound(),
]
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I viewed the activity log after resending a request, I got the following error. I don't know if this is related to this log entry, but can you double-check the event is showing up alright in the activity log?

PHP Fatal error:  Uncaught Error: Call to a member function getFullName() on null in ojs/lib/pkp/classes/log/EmailLogEntry.php:138
Stack trace:
#0 ojs/lib/pkp/controllers/grid/eventLog/EventLogGridCellProvider.php(103): PKP\log\EmailLogEntry->getSenderFullName()
#1 ojs/lib/pkp/classes/controllers/grid/GridCellProvider.php(57): PKP\controllers\grid\eventLog\EventLogGridCellProvider->getTemplateVarsFromRowColumn(Object(PKP\controllers\grid\eventLog\EventLogGridRow), Object(PKP\controllers\grid\GridColumn))
#2 ojs/lib/pkp/classes/controllers/grid/GridHandler.php(1254): PKP\controllers\grid\GridCellProvider->render(Object(APP\core\Request), Object(PKP\controllers\grid\eventLog\EventLogGridRow), Object(PKP\controllers\grid\GridColumn))
#3 ojs/lib/pkp/classes/controllers/grid/GridHandler.php(1155): PKP\controllers\grid\GridHandler->_renderCellInternally(Object(APP\core\Request), Object(PKP\controllers\grid\eventLog\EventLogGridRow), Object(PKP\controllers\grid\GridColumn))
#4 ojs/lib/pkp/classes/controllers/grid/GridHandler.php(1130): PKP\controllers\grid\GridHandler->renderRowInternally(Object(APP\core\Request), Object(PKP\controllers\grid\eventLog\EventLogGridRow))
#5 ojs/lib/pkp/classes/controllers/grid/GridHandler.php(1180): PKP\controllers\grid\GridHandler->renderRowsInternally(Object(APP\core\Request), Array)
#6 ojs/lib/pkp/classes/controllers/grid/GridHandler.php(1055): PKP\controllers\grid\GridHandler->renderGridBodyPartsInternally(Object(APP\core\Request))
#7 ojs/lib/pkp/classes/controllers/grid/GridHandler.php(726): PKP\controllers\grid\GridHandler->doSpecificFetchGridActions(Array, Object(APP\core\Request), Object(APP\template\TemplateManager))
#8 [internal function]: PKP\controllers\grid\GridHandler->fetchGrid(Array, Object(APP\core\Request))
#9 ojs/lib/pkp/classes/core/PKPRouter.php(465): call_user_func(Array, Array, Object(APP\core\Request))
#10 ojs/lib/pkp/classes/core/PKPComponentRouter.php(291): PKP\core\PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(APP\core\Request), Array)
#11 ojs/lib/pkp/classes/core/Dispatcher.php(163): PKP\core\PKPComponentRouter->route(Object(APP\core\Request))
#12 ojs/lib/pkp/classes/core/PKPApplication.php(379): PKP\core\Dispatcher->dispatch(Object(APP\core\Request))
#13 ojs/index.php(21): PKP\core\PKPApplication->execute()
#14 {main}
  thrown in ojs/lib/pkp/classes/log/EmailLogEntry.php on line 138

Copy link
Member Author

@touhidurabir touhidurabir Sep 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NateWr there seems to be some sort of problem but it seems unrelated to this PR, I may be mistaken but it seems that way after digging deeper into it . The problem arise when the sender_id column in the email_log table set to 0 . In my testing, it set to 0 when an author submit a new submission and a mail set to the author for which this log generated with sender_id set to 0 . for now I set a fix which at least not cause the activity log to break and load it via ?-> . I think this need to be addressed via a separate issue . I will file a new one and looked into it .

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok thanks for l ooking into it. Did you get that issue filed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filed at #8273 .

msgid "emails.reviewResendRequest.body"
msgstr ""
"<p>Dear {$recipientName},</p>"
"<p>Recently, you declined our request to review a submission, {$submission Title}, for {$contextName}. I'm writing to see if you are able to conduct the review after all.</p>"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The typo was in my suggestion, but there's an extra space in {$submission Title}.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

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

Successfully merging this pull request may close these issues.

3 participants