Group Entity Support

Created on 21 November 2018, almost 6 years ago
Updated 24 May 2023, over 1 year ago

Hello,

I'll upload a patch to provide the group feature to the content moderation notifications.

It's entirely optional and doesn't alter the module functionality.

When you create a new notification entity, a new checkbox is available if the group module is avalaible in your project to use the group support.

Feature request
Status

Needs review

Version

3.0

Component

Code

Created by

🇫🇷France Piegefull

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇪Ireland stella

    I get the following error on the settings page with latest version of the module and Drupal 9.5.9

    The website encountered an unexpected error. Please try again later.
    Error: Call to undefined method Drupal\group\Entity\GroupRole::isInternal() in Drupal\content_moderation_notifications\Form\ContentModerationNotificationsFormBase::Drupal\content_moderation_notifications\Form\{closure}() (line 248 of modules/contrib/content_moderation_notifications/src/Form/ContentModerationNotificationsFormBase.php).

    If I remove the check for isInternal() introduced in #41, then the page loads. However, it still has no group roles appearing on the form as a result of the rest of the change in #41 as I have no "member" role. I have editor and other roles, and none called "member", so I think that change is too restrictive and doesn't work for every scenario.

  • Status changed to Needs review over 1 year ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    14 pass
  • 🇮🇪Ireland stella

    Updated version of the patch with the change from #41 rolled back.

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    14 pass
  • 🇮🇪Ireland stella

    When testing the actual sending of the notifications I got this error:

    The website encountered an unexpected error. Please try again later.
    
    Drupal\Core\Entity\EntityStorageException: The "group_content" entity type does not exist. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 815 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
    Drupal\Core\Entity\EntityTypeManager->getHandler('group_content', 'storage') (Line: 192)
    Drupal\Core\Entity\EntityTypeManager->getStorage('group_content') (Line: 205)
    Drupal\content_moderation_notifications\Notification->sendNotification(Object, Array) (Line: 100)
    Drupal\content_moderation_notifications\Notification->processEntity(Object) (Line: 36)
    content_moderation_notifications_entity_insert(Object)
    call_user_func_array(Object, Array) (Line: 426)
    Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'content_moderation_notifications') (Line: 405)
    Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_insert', Object) (Line: 433)
    Drupal\Core\Extension\ModuleHandler->invokeAll('entity_insert', Array) (Line: 251)
    Drupal\Core\Entity\EntityStorageBase->invokeHook('insert', Object) (Line: 903)
    Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('insert', Object) (Line: 598)
    Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, ) (Line: 784)
    Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object, ) (Line: 523)
    Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 804)
    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: 114)
    Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
    Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 595)
    Drupal\Core\Form\FormBuilder->processForm('node_blog_form', Array, Object) (Line: 323)
    Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 48)
    Drupal\Core\Entity\EntityFormBuilder->getForm(Object, 'default', Array) (Line: 391)
    Drupal\group\Entity\Controller\GroupRelationshipController->createForm(Object, 'group_node:blog')
    call_user_func_array(Array, Array) (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
    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: 169)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
    Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 50)
    Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
    Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

    This because the "group_content" entity has since been renamed to "group_relationship".

    Updated patch attached for that one change.

Production build 0.71.5 2024