If, for example, a user disables ‘Discussion activity’ notifications, a ‘blocked_notification’ record is created in the ‘notification_subscription_settings’ table and the PKPNotificationOperationManager::createNotification() function returns null because the notification type is blocked, so the call to the $mailable->allowUnsubscribe($notification) function causes a PHP error:
[Fri Dec 20 13:26:44.299598 2024] [php:error] [pid 20092:tid 1920] [client 127.0.0.1:57282] PHP Fatal error: Uncaught TypeError: PKP\mail\mailables\DiscussionSubmission::allowUnsubscribe(): Argument #1 ($notification) must be of type APP\notification\Notification, null given, called in C:\xampp\htdocs\ojs3408\lib\pkp\controllers\grid\queries\QueriesGridHandler.php on line 688 and defined in C:\xampp\htdocs\ojs3408\lib\pkp\classes\mail\traits\Unsubscribe.php:49\nStack trace:\n#0 C:\xampp\htdocs\ojs3408\lib\pkp\controllers\grid\queries\QueriesGridHandler.php(688): PKP\mail\mailables\DiscussionSubmission->allowUnsubscribe(NULL)\n#1 [internal function]: PKP\controllers\grid\queries\QueriesGridHandler->updateQuery(Array, Object(APP\core\Request))\n#2 C:\xampp\htdocs\ojs3408\lib\pkp\classes\core\PKPRouter.php(334): call_user_func(Array, Array, Object(APP\core\Request))\n#3 C:\xampp\htdocs\ojs3408\lib\pkp\classes\core\PKPComponentRouter.php(291): PKP\core\PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(APP\core\Request), Array)\n#4 C:\xampp\htdocs\ojs3408\lib\pkp\classes\core\Dispatcher.php(165): PKP\core\PKPComponentRouter->route(Object(APP\core\Request))\n#5 C:\xampp\htdocs\ojs3408\lib\pkp\classes\core\PKPApplication.php(388): PKP\core\Dispatcher->dispatch(Object(APP\core\Request))\n#6 C:\xampp\htdocs\ojs3408\index.php(21): PKP\core\PKPApplication->execute()\n#7 {main}\n thrown in C:\xampp\htdocs\ojs3408\lib\pkp\classes\mail\traits\Unsubscribe.php on line 49
Yes, OJS version is 3.4.0.8
As you indicate in the message, I can tell you that it is fixed, but not completely.
I have a user with the role of section-editor, who has ‘Discussion added’ disabled, as you say, if I add a new discussion with that user everything works fine. But if I assign that user to the submission, the system performs two actions:
assigning the user to the submission
creation of a new discussion with the subject ‘You have been assigned as an editor on a submission to journalName’. It is at this precise moment that the error occurs and the screen looks like this:
Hello @asmecher
here you are:
[Mon Dec 23 18:33:42.863310 2024] [php:error] [pid 513846] [client 192.168.0.254:52397] PHP Fatal error: Uncaught TypeError: PKP\mail\mailables\DiscussionSubmission::allowUnsubscribe(): Argument #1 ($notification) must be of type APP\notification\Notification, null given, called in /var/www/ojs3408/lib/pkp/controllers/grid/users/stageParticipant/form/PKPStageParticipantNotifyForm.php on line 237 and defined in /var/www/ojs3408/lib/pkp/classes/mail/traits/Unsubscribe.php:49\nStack trace:\n#0 /var/www/ojs3408/lib/pkp/controllers/grid/users/stageParticipant/form/PKPStageParticipantNotifyForm.php(237): PKP\mail\mailables\DiscussionSubmission->allowUnsubscribe()\n#1 /var/www/ojs3408/lib/pkp/controllers/grid/users/stageParticipant/form/PKPStageParticipantNotifyForm.php(155): PKP\controllers\grid\users\stageParticipant\form\PKPStageParticipantNotifyForm->sendMessage()\n#2 /var/www/ojs3408/lib/pkp/controllers/grid/users/stageParticipant/form/AddParticipantForm.php(286): PKP\controllers\grid\users\stageParticipant\form\PKPStageParticipantNotifyForm->execute()\n#3 /var/www/ojs3408/lib/pkp/controllers/grid/users/stageParticipant/StageParticipantGridHandler.php(345): PKP\controllers\grid\users\stageParticipant\form\AddParticipantForm->execute()\n#4 [internal function]: PKP\controllers\grid\users\stageParticipant\StageParticipantGridHandler->saveParticipant()\n#5 /var/www/ojs3408/lib/pkp/classes/core/PKPRouter.php(334): call_user_func()\n#6 /var/www/ojs3408/lib/pkp/classes/core/PKPComponentRouter.php(291): PKP\core\PKPRouter->_authorizeInitializeAndCallRequest()\n#7 /var/www/ojs3408/lib/pkp/classes/core/Dispatcher.php(165): PKP\core\PKPComponentRouter->route()\n#8 /var/www/ojs3408/lib/pkp/classes/core/PKPApplication.php(395): PKP\core\Dispatcher->dispatch()\n#9 /var/www/ojs3408/index.php(21): PKP\core\PKPApplication->execute()\n#10 {main}\n thrown in /var/www/ojs3408/lib/pkp/classes/mail/traits/Unsubscribe.php on line 49, referer: https://desarrollo22.ojs3408.upct.es/index.php/sbir/workflow/index/2/1