From 1efc6cfe4fda498690acf7683a02a8ebbb814222 Mon Sep 17 00:00:00 2001
From: owenbush <ojb@ukhhf.co.uk>
Date: Mon, 5 Aug 2019 11:12:38 -0600
Subject: [PATCH] If eventseries not moderated, recreated the eventinstances
 straight away rather than waiting for the series to be published

---
 recurring_events.module | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/recurring_events.module b/recurring_events.module
index a3649ec8..5192aa9f 100644
--- a/recurring_events.module
+++ b/recurring_events.module
@@ -222,11 +222,12 @@ function template_preprocess_eventseries(array &$variables) {
 function recurring_events_eventseries_presave(EntityInterface $entity) {
   $original = $entity->original;
   $creation_service = \Drupal::service('recurring_events.event_creation_service');
+  $moderated = $entity->hasField('moderation_state');
 
   // If the eventseries is being published, or created for the first time then
   // there may be date recurrence changes that need to be converted into new
   // eventinstance entities.
-  if ($entity->isPublished() || $entity->isNew()) {
+  if ($entity->isPublished() || $entity->isNew() || !$moderated) {
     if ($entity->isDefaultTranslation()) {
       $creation_service->saveEvent($entity, $original);
     }
-- 
GitLab