Group Entity Support

Created on 21 November 2018, over 6 years ago
Updated 24 May 2023, almost 2 years 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 work

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

Merge Requests

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 almost 2 years ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update almost 2 years 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 almost 2 years 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.

  • First commit to issue fork.
  • Here's the patch against the 8.x-3.7 version
    The PR is opened for review

  • Pipeline finished with Success
    4 months ago
    Total: 148s
    #366757
  • 🇩🇪Germany vistree

    @naveenvalecha,
    after using your latest patch #50 I get an error on editiong and creating new group notifications:
    Error: Call to undefined method Drupal\group\Entity\GroupRole::isInternal()
    The full message is:

    The website encountered an unexpected error. 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 251 of modules/contrib/content_moderation_notifications/src/Form/ContentModerationNotificationsFormBase.php).
    array_filter() (Line: 252)
    Drupal\content_moderation_notifications\Form\ContentModerationNotificationsFormBase->buildForm()
    call_user_func_array() (Line: 536)
    Drupal\Core\Form\FormBuilder->retrieveForm() (Line: 284)
    Drupal\Core\Form\FormBuilder->buildForm() (Line: 97)
    Drupal\autosave_form\Form\AutosaveFormBuilder->buildForm() (Line: 73)
    Drupal\Core\Controller\FormController->getContentResult()
    call_user_func_array() (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
    Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
    Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
    Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
    Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
    Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
    Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741)
    Drupal\Core\DrupalKernel->handle() (Line: 19)
Production build 0.71.5 2024