Problem/Motivation

One of the last remaining @todos in content moderation reads:

// @todo what if $entity->moderation_state is null at this point?

This is found in a protected method EntityOperations::updateOrCreateFromEntity which is called only for moderated entities:

  public function entityInsert(EntityInterface $entity) {
    if ($this->moderationInfo->isModeratedEntity($entity)) {
      $this->updateOrCreateFromEntity($entity);
    }
  }

Proposed resolution

The moderation_state field is never NULL for non-moderated entities. Add a test case for this and remove the todo.

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#2 2973493-2.patch1.5 KBSam152
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Sam152 created an issue. See original summary.

Sam152’s picture

Status: Active » Needs review
FileSize
1.5 KB
timmillwood’s picture

Status: Needs review » Reviewed & tested by the community

Thanks @Sam152!

Removes a @todo question by answering it with a test! Perfect!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed add4d39507 to 8.6.x and a9333869bb to 8.5.x. Thanks!

  • alexpott committed add4d39 on 8.6.x
    Issue #2973493 by Sam152: Remove @todo in content_moderation related to...

  • alexpott committed a933386 on 8.5.x
    Issue #2973493 by Sam152: Remove @todo in content_moderation related to...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.