- Install this module
- Create or edit an existing content moderation notification
- enable + disable "Use group membership"
Edit a node and set a moderation workflow which will run the moderation notification
Debug function content_moderation_notifications_group_content_moderation_notification_mail_data_alter
There is NO check, if the "Use group membership" is enabled at all and some "funny" user selection will happen.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

vistree created an issue.

vistree’s picture

We should check, if

  $group_use = $config->getThirdPartySetting('content_moderation_notifications_group', 'group_use');

isset. Otherwise we should not continue the function content_moderation_notifications_group_content_moderation_notification_mail_data_alter

But this is not enough - using a content_moderation_notification with enabled group the mails are still send out to wrong recipients.

vistree’s picture

This is the total code which needs to be replaced within content_moderation_notifications_group.module

/**
 * Implements hook_content_moderation_notification_mail_data_alter().
 */
function content_moderation_notifications_group_content_moderation_notification_mail_data_alter(EntityInterface $entity, array &$data) {
  /** @var \Drupal\content_moderation_notifications\Entity\ContentModerationNotification $config */
  $config = $data["notification"];
+ $group_use = $config->getThirdPartySetting('content_moderation_notifications_group', 'group_use');

+ if (!isset($group_use)) {
+   return;
+ }
  $group_relationships = \Drupal::entityTypeManager()
    ->getStorage('group_relationship')
    ->loadByProperties([
       'group_type' => $config->getThirdPartySetting('content_moderation_notifications_group', 'group_type'),
      'entity_id' => $entity->id(),
+     'plugin_id' => 'group_node:' . $entity->bundle(),
     ]);

vistree changed the visibility of the branch 3561690-if-use-group to hidden.