Syncing entities should not have notifications delivered

Created on 15 February 2024, 4 months ago
Updated 10 June 2024, 18 days ago

Problem/Motivation

When entities are syncing, the changes being performed on said entity are more or less background noise. It's likely not expected that notifications would be dispatched for syncing entities.

Steps to reproduce

Not that I've ever done this, but...πŸ˜‡

  1. Configure notifications to be sent for a node type
  2. Write an update hook that applies a small change to a large number of nodes, such as updating a text format for a field
  3. Execute the update hook
  4. Watch in horror as you just accidentally delivered a ton of email

Proposed resolution

Add a syncing check in Drupal\content_moderation_notifications\Notification::processEntity.

  public function processEntity(EntityInterface $entity) {
    if (!$entity instanceof SynchronizableInterface || !$entity->isSyncing()) {
      $notifications = $this->notificationInformation->getNotifications($entity);
      if (!empty($notifications)) {
        $this->sendNotification($entity, $notifications);
      }
    }
  }

Remaining tasks

  1. Agree this is a good change
  2. Open a merge request
  3. Review
  4. Merge

User interface changes

None

API changes

None

Data model changes

None

πŸ› Bug report
Status

Closed: duplicate

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States Luke.Leber Pennsylvania

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024