commit 819f9a61ee580d230892dfc47f0145cb354f469c
Author: Kozma Adrian <adrian.kozma@agenceinovae.com>
Date:   Mon Jun 12 14:35:45 2017 +0300

    Fix the default staus check for 8.3.3.

diff --git a/src/NotificationInformation.php b/src/NotificationInformation.php
index 83e33ea..90bf81d 100644
--- a/src/NotificationInformation.php
+++ b/src/NotificationInformation.php
@@ -61,7 +61,21 @@ class NotificationInformation implements NotificationInformationInterface {
     $transition = FALSE;
     if (($workflow = $this->getWorkflow($entity))) {
       $current_state = $entity->moderation_state->value;
-      $previous_state = isset($entity->last_revision)? $entity->last_revision->moderation_state->value : $workflow->getInitialState()->id();
+
+      if (isset($entity->last_revision)) {
+        $previous_state = $entity->last_revision->moderation_state->value;
+      }
+      else if ($entity->original == NULL) {
+        // TODO Better way to get the default state?
+        // The entity status value is "TRUE" already when using the option
+        // "Save and Publish", so getInitialState returns "published" instead of
+        // "draft".
+        $previous_state = 'draft';
+      }
+      else {
+        $previous_state = $workflow->getTypePlugin()->getInitialState($workflow, $entity)->id();
+      }
+
       $transition = $workflow->getTransitionFromStateToState($previous_state, $current_state);
     }
 
@@ -87,9 +101,10 @@ class NotificationInformation implements NotificationInformationInterface {
 
       $notification_ids = $query->execute();
 
-      $notifications['notifications'] = $this->entityTypeManager
+      $notifications['notifications'] = !empty($notification_ids) ? $this->entityTypeManager
         ->getStorage('content_moderation_notification')
-        ->loadMultiple($notification_ids);
+        ->loadMultiple($notification_ids)
+        : [];
     }
 
     return $notifications;
