-
Notifications
You must be signed in to change notification settings - Fork 448
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#5885 Review remainder update #9612
Conversation
a530c90
to
0eca63d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @touhidurabir! I left a couple of minor comments but what I'm thinking about is the possibility for journals to set the number of reminders they want rather than predefined before... and after... fields. Have you considered this option?
'size' => 'small', | ||
])) | ||
->addField(new FieldText('numDaysBeforeSubmitReminder', [ | ||
// $this->addField(new FieldText('numDaysBeforeInviteReminder', [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just keeping a reminder that these commented lines should be removed before merging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed .
// ])); | ||
|
||
$this | ||
->addField(new FieldHTML('reviewRequestResponseRemainder', [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reviewRequestResponseRemainder
=> submissionReviewResponseReminder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
|
||
namespace PKP\migration\upgrade\v3_5_0; | ||
|
||
use Illuminate\Database\Schema\Blueprint; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you check which imports are not necessary here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
classes/task/ReviewReminder.php
Outdated
$currentDate->gte($dateResponseDue) && | ||
$currentDate->diffInDays($dateResponseDue) >= $numDaysAfterReviewResponseReminderDue) { | ||
|
||
// ACTION:-> we need to sent a AFTER REVIEW REQUEST RESPONSE remainder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...to send the AFTER REVIEW REQUEST RESPONSE reminder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you check this in other comments too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
classes/task/ReviewReminder.php
Outdated
|
||
if ($reviewAssignment->getDateConfirmed() === null) { | ||
// review request has not been responded | ||
// previous remainder was a BEFORE REVIEW REQUEST RESPONSE remainder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reminder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
use Exception; | ||
use PKP\validation\ValidatorFactory; | ||
|
||
class ValidatorDateConparison extends Validator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ValidatorDateConparison => ValidatorDateComparison
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
* @param string $type the type of check, either "required" or "optional" | ||
* @param string $message the error message for validation failures (i18n key) | ||
*/ | ||
public function __construct(&$form, $field, $comparingDate, $comparingRule, $type = 'optional', $message = 'email.invalid') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default value for $message
looks wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
jobs/email/ReviewRemainder.php
Outdated
|
||
$submission = Repo::submission()->get($this->submissionId); | ||
|
||
$contextService = Services::get("context"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"context" => 'context'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
jobs/email/ReviewRemainder.php
Outdated
use PKP\jobs\BaseJob; | ||
|
||
|
||
class ReviewRemainder extends BaseJob |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ReviewReminder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
@touhidurabir, thinking about this further, one way to achieve this is adding a context setting that depicts a number of email reminders to show. Something like: $this->addField(new FieldText('numReviewRequestResponseReminders', [
'label' => __('manager.setup.reviewOptions.numReviewRequestResponseReminders'),
'description' => __('manager.setup.reviewOptions.numReviewRequestResponseReminders.description'),
'value' => $context->getData('numReviewRequestResponseReminders'),
'size' => 'small',
])); And a setting to hold values for all custom fields. Each reminder option should accept negative numbers if implementing this way foreach ($context->getData('reviewRequestResponseReminders') as $reviewRequestResponseReminder) {
$this->addField(new FieldText('requestResponseReminder', [
...
]));
} This also requires Vue form modification to support new fields added/subtracted dynamically - by listening to the Another way could be adding a new form field component that dynamically supports custom number of inputs depending on a value of another field... |
cc2d253
to
4a450bb
Compare
Hi @Vitaliy-1 , can you explain how the negative number works in bit more details , I am still bit confused how it will work . I have followed the following implementation approach
The implementation that I have designed is so that it will only sent one such reminder for each case that is
so for each above 4 cases, only one reminder for each case and no more than that . |
Hey @touhidurabir -- please hold off on this one until @Devika008 has had a chance to review things. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is promising, @touhidurabir; I've added some comments, and it also needs some work per Devika's design work to make it friendlier.
} | ||
|
||
if (!PKP_STRICT_MODE) { | ||
class_alias('\PKP\form\validation\FormValidatorDateCompare', '\FormValidatorDateCompare'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should only be necessary for old code; for new code, just make sure to use FQCNs and use
statements where they're needed.
{ | ||
parent::__construct(__('publication.jats.defaultContentCreationError'), null, $innerException); | ||
parent::__construct( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these changes be in a different PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these changes be in a different PR?
that is true but because of this I was having some issue with some of workflow page loading to run some tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's already been resolved in main
in 8ded2f3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then it will be removed at next rebase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still showing up in the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
classes/migration/upgrade/v3_5_0/I5885_RenameReviewReminderSettingsName.php
Outdated
Show resolved
Hide resolved
60dae69
to
8cf585d
Compare
8c4b2b0
to
c2a1432
Compare
@asmecher take a look at the PR again . |
00e1ad2
to
f545ee4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @touhidurabir; here are some minor changes to suggest. When this is reviewed, could you follow up by posting some screenshots showing the change on the issue, and tag Devika for a look?
$this | ||
->addDefaultFields($context) | ||
->addReminderFields($context) | ||
->addReminderDisbaleNoticeField($context); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*Disable
/** | ||
* @file classes/form/validation/FormValidatorDateCompare.php | ||
* | ||
* Copyright (c) 2014-2021 Simon Fraser University |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2024 for new code.
{ | ||
parent::__construct(__('publication.jats.defaultContentCreationError'), null, $innerException); | ||
parent::__construct( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still showing up in the PR.
|
||
public function __construct(DateTimeInterface|Carbon $comparingDate, string $comparingRule) | ||
{ | ||
if (!in_array($comparingRule, static::getComparingRules())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about using an Enum for this, instead of runtime validation? We've applied this to a few other places in the code, and so far I like it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done refactoring to enum . I was not sure if we are using enums but as I see we are now, better to do that from now on rather than using constants .
} | ||
|
||
if (!PKP_STRICT_MODE) { | ||
class_alias('\PKP\validation\ValidatorDateComparison', '\ValidatorDateComparison'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need class aliases for new code -- only for backwards compatibility with old code. (As above)
jobs/email/ReviewReminder.php
Outdated
{ | ||
parent::__construct(); | ||
|
||
$this->reviewAssignmentId = $reviewAssignmentId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you're using promotion, there's no need to assign these in the constructor.
jobs/email/ReviewReminder.php
Outdated
{ | ||
public function __construct( | ||
public int $reviewAssignmentId, | ||
public int $submissionId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The $submissionId
and $contextId
can be derived from the review assignment; would it be better not to serialize them then have to check for discrepancies? (For example, later on we look at the $submissionId
to fetch the submission from the database -- but there's no check to ensure it matches the submission ID in the review assignment. It would be better just to use the reviewAssignmentId
, then get the submission ID etc. from that.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think thats better as we intend to keep the job serialized data as small as possible .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However I think we need to set the standard to passing contextId
whenever it's possible as our Services
class bit too hard to mock.
locale/en/editor.po
Outdated
@@ -205,6 +205,9 @@ msgstr "Email to be sent to reviewer" | |||
msgid "editor.review.importantDates" | |||
msgstr "Important Dates" | |||
|
|||
msgid "editor.review.importantDates.notice" | |||
msgstr "Review due date must be greater or euqal to response due date." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*equal
2936c39
to
ccbbc26
Compare
@@ -205,8 +205,7 @@ protected function mockRequest($path = 'index/test-page/test-op', $userId = null | |||
$request->setRouter($router); | |||
|
|||
// Test user. | |||
$session = $request->getSession(); | |||
$session->setUserId($userId); | |||
$request->getSessionGuard()->setUserId($userId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a leftover from #9566. this and above in the function signature .
@@ -23,7 +23,7 @@ | |||
use PKP\invitation\invitations\enums\InvitationStatus; | |||
use PKP\mail\variables\ReviewAssignmentEmailVariable; | |||
use PKP\security\Validation; | |||
use ReviewAssignment; | |||
use PKP\submission\reviewAssignment\ReviewAssignment; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This proper namespace update is required for mocking
@asmecher can you take another look specifically at the commit test added for queue job . I have added some tests and at the same time I had to update in the core |
cd08a01
to
e4761a8
Compare
@asmecher rebased and all tests are passing . please take a final look . |
b4b5fda
to
d4ad06b
Compare
locale/en/manager.po
Outdated
msgstr "" | ||
"Send an email reminder if a reviewer has not responded to a review request " | ||
"this many days after the response due date." | ||
"Send an email reminder before or after for review request response(if reviewer has not responded " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space before (
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
locale/en/manager.po
Outdated
msgid "manager.setup.reviewOptions.reminders.submit" | ||
msgstr "Review Reminder" | ||
msgid "manager.setup.reviewOptions.reminders.response.before" | ||
msgstr "Response Request Response - Before Due Date" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be "Review Request Response", not "Response Request Response"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
locale/en/manager.po
Outdated
"Send an email reminder if a reviewer has not submitted a recommendation " | ||
"within this many days after the review's due date." | ||
msgid "manager.setup.reviewOptions.reminders.response.after" | ||
msgstr "Response Request Response - After Due Date" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also here: should be "Review Request Response", not "Response Request Response"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
e68f392
to
f7b56a5
Compare
…ponent enhancement
… path before resolving from request
45e4be1
to
98a5db2
Compare
for #5885