Problem/Motivation
When the previous user is an Anonymous user getting php error as below
The website encountered an unexpected error. Please try again later.
Error: Call to a member function getEmail() on null in Drupal\content_moderation_notifications\Notification->sendNotification() (line 146 of modules/contrib/content_moderation_notifications/src/Notification.php).
Drupal\content_moderation_notifications\Notification->sendNotification(Object, Array) (Line: 92)
Drupal\content_moderation_notifications\Notification->processEntity(Object) (Line: 29)
content_moderation_notifications_entity_update(Object)
call_user_func_array('content_moderation_notifications_entity_update', Array) (Line: 403)
Drupal\Core\Extension\ModuleHandler->invokeAll('entity_update', Array) (Line: 201)
Drupal\Core\Entity\EntityStorageBase->invokeHook('update', Object) (Line: 800)
Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('update', Object) (Line: 530)
Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, 1) (Line: 685)
Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object, 1) (Line: 455)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 801)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 339)
Drupal\Core\Entity\EntityBase->save() (Line: 270)
Drupal\node\NodeForm->save(Array, Object)
call_user_func_array(Array, Array) (Line: 113)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 602)
Drupal\Core\Form\FormBuilder->processForm('node_page_edit_form', Array, Object) (Line: 321)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object) (Line: 39)
Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 578)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 158)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 49)
Asm89\Stack\Cors->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 717)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Steps to reproduce
step 1 :Create a user and login into admin and remember to enable notification to revision user
step 2: modify any of the article
step 3 delete the newly created user and choose the option to keep the content and make owner as Anonymous user
step 4: edit the previously edited article and save the article will end with php error as above
Proposed resolution
Add a validation to Revision user data before calling the getEmail() function.
Remaining tasks
Nil
User interface changes
Nil
API changes
Nil
Data model changes
Nil