Problem/Motivation

Ran into this in #2914839: The current moderation state in the "meta" region on content entity forms is coupled to the moderation_state field widget..

Inside prepareTranslation, the new translation is created like so:

  public function prepareTranslation(ContentEntityInterface $entity, LanguageInterface $source, LanguageInterface $target) {
    /* @var \Drupal\Core\Entity\ContentEntityInterface $source_translation */
    $source_translation = $entity->getTranslation($source->getId());
    $target_translation = $entity->addTranslation($target->getId(), $source_translation->toArray());

The key part is $source_translation->toArray() in order to gather field data to initialise the new translation. This happens like so:

    foreach ($this->getFields() as $name => $property) {
      $values[$name] = $property->getValue();
    }

Which translates roughly into the equivalent of:

$entity->get('moderation_state')->getValue();

This doesn't work for the moderation_state field and thus a new translation will not be initialised with the moderation state from the previous translation.

Proposed resolution

Lets fix the computed field to handle all scenarios where the field item list can be accessed by making use of the work in #2392845: Add a trait to standardize handling of computed item lists.

Remaining tasks

Commit!

User interface changes

Fixes a user interface bug with entity translations not having the correct initial state.

API changes

None.

Data model changes

None.

CommentFileSizeAuthor
#66 2915398-66.patch6.58 KBSam152
#66 interdiff.txt2.77 KBSam152
#64 2915398-64_REMOVED_NULL_CHECK_IN_COMPUTE_VALUE.patch5.54 KBSam152
#64 inter-interdiff.txt865 bytesSam152
#64 2915398-64.patch5.69 KBSam152
#64 interdiff.txt1.18 KBSam152
#55 2915398-55.patch5.74 KBtimmillwood
#55 interdiff-2915398-55.txt2.26 KBtimmillwood
#50 2915398-50.patch5.57 KBtimmillwood
#50 interdiff-2915398-50.txt1.31 KBtimmillwood
#48 patch-applied.png143.69 KBSam152
#48 no-patch-applied.png166.2 KBSam152
#44 2915398-44.patch5.63 KBSam152
#40 attempt.patch2.15 KBSam152
#38 2915398-36.patch5.63 KBSam152
#33 2915398-33.patch5.48 KBSam152
#33 interdiff.txt1 KBSam152
#32 2915398-32.patch5.03 KBSam152
#32 interdiff.txt2.15 KBSam152
#30 test-fix.txt1.19 KBSam152
#26 2915398-26.patch3.41 KBtimmillwood
#26 interdiff-2915398-26.txt990 bytestimmillwood
#23 2915398-23.patch3.34 KBtimmillwood
#23 interdiff-2915398-23.txt667 bytestimmillwood
#20 2915398-20.patch3.38 KBamateescu
#19 interdiff.txt898 bytesamateescu
#19 2915398-19.patch3.32 KBamateescu
#19 2915398-19-combined.patch16.11 KBamateescu
#16 interdiff.txt741 bytesamateescu
#16 2915398-15.patch3.38 KBamateescu
#16 2915398-15-combined.patch13.13 KBamateescu
#15 2915398-15-combined.patch12.95 KBSam152
#11 interdiff.txt2.59 KBamateescu
#11 2915398-11.patch3.21 KBamateescu
#11 2915398-11-combined.patch13.7 KBamateescu
#4 2915398-4.patch1.54 KBSam152
#4 interdiff.txt722 bytesSam152
#2 2915398-2.patch1.56 KBSam152
#2 2915398-2-TEST_ONLY.patch838 bytesSam152
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
838 bytes
1.56 KB
Sam152’s picture

Issue summary: View changes
Sam152’s picture

Fixing method name.

The last submitted patch, 2: 2915398-2-TEST_ONLY.patch, failed testing. View results

Sam152’s picture

Issue summary: View changes
Sam152’s picture

Title: The moderation_state field is not computed during the creation of a new entity translation. » [PP-1] The moderation_state field is not computed during the creation of a new entity translation.
Sam152’s picture

Title: [PP-1] The moderation_state field is not computed during the creation of a new entity translation. » The moderation_state field is not computed during the creation of a new entity translation.
timmillwood’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Workflow Initiative

Looks good to me, I tried to see if I could find a better solution, but not sure there is.

I guess as this is a bug it should also be backported to 8.4.x too?

Sam152’s picture

Yeah, I think a backport makes sense. I also dropped a note in #2392845: Add a trait to standardize handling of computed item lists that getValue is another method which should trigger a "calculate" on computed fields.

amateescu’s picture

Version: 8.5.x-dev » 8.4.x-dev
Status: Reviewed & tested by the community » Needs review
FileSize
13.7 KB
3.21 KB
2.59 KB

I'd like to increase the scope of this issue a bit and make ModerationStateFieldItemList use the trait added in #2392845: Add a trait to standardize handling of computed item lists so we don't start getting bug reports for each method that is not computing the value :)

Sam152’s picture

Makes perfect sense, the content_moderation test suite might also turn up any issues with the implementation of the trait thus far.

amateescu’s picture

... the content_moderation test suite might also turn up any issues with the implementation of the trait thus far.

That's exactly what I'm hoping for :)

The last submitted patch, 11: 2915398-11-combined.patch, failed testing. View results

Sam152’s picture

One more combined patch now that the other issue is green.

amateescu’s picture

@Sam152, this should fix all the failures here, which makes me think that the default "caching" added by the trait is not really useful because most computed fields will probably have their own way of checking if the values were already computed or not.

I was working on this for a few hours, so the interdiff is to #11.

The last submitted patch, 15: 2915398-15-combined.patch, failed testing. View results

timmillwood’s picture

Title: The moderation_state field is not computed during the creation of a new entity translation. » [PP-1] The moderation_state field is not computed during the creation of a new entity translation.
Parent issue: » #2392845: Add a trait to standardize handling of computed item lists

Looks pretty nice. I guess this is now postponed on #2392845: Add a trait to standardize handling of computed item lists, but leaving as "Needs review" for now, just going to prepend the title.

amateescu’s picture

amateescu’s picture

That issue circled back around and the trait is again at the typed data level, so re-uploading #16 just so it's the last good patch here.

amateescu’s picture

Title: [PP-1] The moderation_state field is not computed during the creation of a new entity translation. » The moderation_state field is not computed during the creation of a new entity translation.

The parent issue is in so this is unblocked now.

Status: Needs review » Needs work

The last submitted patch, 20: 2915398-20.patch, failed testing. View results

timmillwood’s picture

Status: Needs work » Needs review
FileSize
667 bytes
3.34 KB

Updating doComputeValue() to ensureComputedValue().

amateescu’s picture

Great, now who wants to RTBC? :)

jibran’s picture

+++ b/core/modules/content_moderation/src/Plugin/Field/ModerationStateFieldItemList.php
@@ -14,6 +15,29 @@
+    if (!isset($this->list[0]) || $this->list[0]->isEmpty()) {

Can we please add a comment here to explain why we ware overriding this function?

timmillwood’s picture

This patch removes the need to override the ensureComputedValue() method.

Calling $entity->moderation_state->value = "draft" uses \Drupal\content_moderation\Plugin\Field\ModerationStateFieldItemList::setValue() to set the value in $this->list but when fetching the value from $entity->moderation_state->value this is ignored because $this->valueComputed is FALSE, so it computes the value rather than using the set value.

So in the patch, after calling setValue() the property $this->valueComputed is set to TRUE to prevent computing the value and overwriting the set value.

Status: Needs review » Needs work

The last submitted patch, 26: 2915398-26.patch, failed testing. View results

timmillwood’s picture

Seems like there are still occasions when $this->list is empty, and $this->valueComputed is set to TRUE, so the values don't get computed.

amateescu’s picture

I tried to debug this today but I didn't get anywhere.. I'll try again tomorrow.

Sam152’s picture

FileSize
1.19 KB

EntityStateChangeValidationTest can be fixed with the attached. The moderation_state field is set to be translateable, so I don't think it's meant to automatically be populated when adding a new translation? This is also how translations are created in ContentTranslationController::prepareTranslation.

Still looking at the ModerationStateNodeTest fails.

Sam152’s picture

+++ b/core/modules/content_moderation/src/Plugin/Field/ModerationStateFieldItemList.php
@@ -83,41 +98,6 @@ protected function loadContentModerationStateRevision(ContentEntityInterface $en
-  /**
-   * Recalculate the moderation field item list.
-   */
-  protected function computeModerationFieldItemList() {
-    // Compute the value of the moderation state.
-    $index = 0;
-    if (!isset($this->list[$index]) || $this->list[$index]->isEmpty()) {

This is the source of the behavioural change. When a field is hidden, the widget still exists in the form array and the entity is built with $entity->moderation_state = '';. Previously if the list item was empty, we would always recompute. Now we don't do that. When '' is set, we consider that the value and we don't attempt to recompute values.

I think we should not accept empty field items as $valueComputed = TRUE in ComputedItemListTrait.

Sam152’s picture

Status: Needs work » Needs review
FileSize
2.15 KB
5.03 KB

Here is the test fix from #30 as well a test to drill down on the exact behavioural change between the two patches. Doubting if this should actually go in ComputedItemListTrait, because it does seem like it should be possible to update a computed field to empty, just not a content moderation field it seems.

Sam152’s picture

So based on the above analysis, I think overriding ensureComputedValue is the correct approach. Lets however use the same approach as ComputedItemListTrait::ensureComputedValue for caching, but just add our one specific $this->list[0]->isEmpty() check. So we should now have:

  • A green patch 🤞.
  • No behavioural changes + explicit test coverage for this behaviour.
  • The comment requested in #25.
Sam152’s picture

Last question, I have is should we be setting $this->valueComputed = TRUE; any time we call updateModeratedEntity?

amateescu’s picture

Thanks @Sam152, that really nice detective work :)

The fact that the moderation state field should never be empty is the key here. However, I think the question in #34 should be applied on a general scale: why don't we set the unpublished state value by default in setValue() when no other state is given by the form or an API call.

This also means we should probably test what happens when we do unset($node->moderation_state). That call should also result in setting the value to 'draft' IMO.

amateescu’s picture

+++ b/core/modules/content_moderation/src/Plugin/Field/ModerationStateFieldItemList.php
@@ -14,6 +15,33 @@
+    $moderation_state = $this->getModerationStateId();
+    // Do not store NULL values in the static cache.
+    if ($moderation_state) {
+      // An entity can only have a single moderation state.
+      $this->list[0] = $this->createItem(0, $moderation_state);
+    }

This is the part that maybe should be updated to *always* set a value. Which means that we should change getModerationStateId() so it can never return NULL, and return the default unpublished state by default.

The last submitted patch, 32: 2915398-32.patch, failed testing. View results

Sam152’s picture

Thanks! :)

Doing it in setValue would also require the same check in onChange, so we'd be back to trying to sleuth methods that impact $this->list in ModerationStateFieldItemList which we're trying to avoid and have ComputedItemListTrait do for us. But I also don't mind if you feel strongly about it.

Nice extra test case + fix.

+++ b/core/modules/content_moderation/src/Plugin/Field/ModerationStateFieldItemList.php
@@ -14,6 +15,33 @@
+    if ($this->valueComputed === FALSE || !isset($this->list[0]) || $this->list[0]->isEmpty()) {

+++ b/core/modules/content_moderation/tests/src/Kernel/ModerationStateFieldItemListTest.php
@@ -80,6 +80,27 @@ public function testArrayIteration() {
+
+    unset($this->testNode->moderation_state);
+    $this->assertEquals('draft', $this->testNode->moderation_state->value);

These parts changed (sorry missed the interdiff).

Sam152’s picture

#38 was a cross post with #36, trying that approach now.

Sam152’s picture

#36 didn't work (see attempt.patch, applies on top of #38) because it kicks in during the computing of the existing content state, not during the setting of a a new state. Thus I still prefer #38 so far.

Status: Needs review » Needs work

The last submitted patch, 40: attempt.patch, failed testing. View results

Sam152’s picture

Status: Needs work » Needs review

The last submitted patch, 33: 2915398-33.patch, failed testing. View results

Sam152’s picture

Reuploading #38 so it's obvious what needs review.

timmillwood’s picture

  1. +++ b/core/modules/content_moderation/src/Plugin/Field/ModerationStateFieldItemList.php
    @@ -14,6 +15,33 @@
    +  /**
    +   * Ensures that values are only computed once.
    +   */
    +  protected function ensureComputedValue() {
    

    Shouldn't this be {@inheritdoc}?

  2. +++ b/core/modules/content_moderation/src/Plugin/Field/ModerationStateFieldItemList.php
    @@ -14,6 +15,33 @@
    +    if ($this->valueComputed === FALSE || !isset($this->list[0]) || $this->list[0]->isEmpty()) {
    +      $this->computeValue();
    +      $this->valueComputed = TRUE;
    

    I'd be tempted to do:

    if (!isset($this->list[0]) || $this->list[0]->isEmpty()) {
      $this->valueComputed = FALSE;
    }
    parent::ensureComputedValue();
    

    I'm not too fussy, but it would ensure that we use any future changes to the method in the trait, and future changes are tested with Content Moderation.

mstef’s picture

Tested out the patch from #44.

I may be misunderstanding the issue but it does not seem to work correctly.

1) Create a page node in English set to a workflow state of "Needs review" rather than "Draft".
2) Add a translation for French.
3) When adding the translation, it says the current state is "Needs review" whereas it should be "Draft". This happens with whatever state the English version is in.

If it were just the "Current state" label that was the issue, it would be okay, but the transitions that are available reflect that invalid state as well.

Before this patch, on 8.4.2, the label and available transitions are correct, but the validation is incorrect as that it assumes the new translation has the same state of the original copy. So it's basically the opposite.

EDIT: By "correct" I mean the new translation starts as a draft. I reread this issue and now I realize that point of this fix is to make the translation start at the state that the original copy is in. That does not make sense to me. If English is in a state such as "Needs review", creating a translation should not automatically mean that is ready for review, etc.

Sam152’s picture

Thanks for the review.

#45.1: I'm not sure, can we inherit docs from a trait instead of a parent?
#45.2: Same here, tried this and parent::ensureComputedValue() doesn't exist because it comes in via the trait.

@mstef, this issue is mostly focused around making the computed field behave as closely to a normal field as possible. This is the test case that was failing, which just happened to expose itself through the creation of a new translation:

+++ b/core/modules/content_moderation/tests/src/Kernel/ModerationStateFieldItemListTest.php
@@ -80,6 +80,27 @@ public function testArrayIteration() {
+  public function testGetValue() {
+    $this->assertEquals([['value' => 'draft']], $this->testNode->moderation_state->getValue());
+  }

I only hit this from an API level, not via creating translations from the UI. When a translation is initialised, the values from the source translation are copied over, so I think given the old behaviour was only the result of a bug in FieldItemList. To make things even more confusing, the bug probably only exposed itself for states that weren't published/draft, since these become the default based on the publishing status. I haven't tested this from the UI, but a round-about way of testing what the patch is already testing would be:

diff --git a/core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php b/core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php
index e52bf96137..6a45d3177f 100644
--- a/core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php
+++ b/core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php
@@ -399,6 +399,37 @@ public function testMultilingualModeration() {
   }
 
   /**
+   * Test the initial states when doing multilingual moderation
+   */
+  public function testMultilingualModerationInitialStates() {
+    ConfigurableLanguage::createFromLangcode('fr')->save();
+    $node_type = NodeType::create([
+      'type' => 'example',
+    ]);
+    $node_type->save();
+
+    $workflow = Workflow::load('editorial');
+    $workflow->getTypePlugin()->addEntityTypeAndBundle('node', 'example');
+    $workflow->save();
+
+    // Create an english node in the "archived" state, an unpublished state
+    // which is not "draft", the default unpublished state.
+    $english_node = Node::create([
+      'type' => 'example',
+      'title' => 'Test title',
+      'moderation_state' => 'archived',
+    ]);
+    $english_node->save();
+
+    // Create a french node, initialised from the english verison, as per
+    // ContentTranslationController::prepareTranslation.
+    $english_node = $this->reloadEntity($english_node);
+    $french_node = $english_node->addTranslation('fr', $english_node->toArray());
+    // Ensure the french node starts its life out in the archived state.
+    $this->assertEquals('archived', $french_node->moderation_state->value);
+  }
+
+  /**
    * Tests moderation when the moderation_state field has a config override.
    */
   public function testModerationWithFieldConfigOverride() {

This fails in HEAD, but passes with the patch applied. If I'm reading your analysis in #46 correctly, this inadvertently fixed a bug with the transition validation but introduced a behavioural change which you previously presumed to be intended?

Tricky stuff, thanks for testing this in any case.

Sam152’s picture

Priority: Normal » Major
Issue summary: View changes
FileSize
166.2 KB
143.69 KB

I reproduced #46 from the UI by:

1. Enabling CM and translation on "article".
2. Deleting the "Restore to Draft" transition.
3. Archiving an item of content.
4. Create a translation of that item of content.
5. Toggle patch, see different behaviors.

No patch

Patch

So from what I can tell, the behavior after the patch is applied is correct and new translations should not revert to draft when created from the UI, given it's how all other translatable fields work.

So the question from here is, are we happy with tests that fix the underlying API or do we want some explicit UI tests for the translation/transition validation stuff, which was fixed implicitly?

mstef’s picture

Okay thanks for the explanation and the patch. I was confused by the issue.

I still personally think the functionality is not correct; but that's not for me to decide. I don't think that workflow states should be copied over like other fields because it's not like other fields. It's a status / not a value. Perhaps I can find a way to reset the workflow state when new translations are initialized.

timmillwood’s picture

I think @mstef is correct. When adding a translation we should not show anything in the meta sidebar, and not show a current state. The state for new translation should be assumed to be the initial state, however in ModerationStateFieldItemList $entity->isNewTranslation() returns FALSE. So I opened #2927455: When adding a new translation the entity should start from the draft state to fix that. This can be done as a follow up because the current functionality of this patch fixes an already big issue and holding that up would be a real shame.

Here's a patch fixing the items in #45.

Think we're good for RTBC?

mstef’s picture

Thanks for opening that @timmillwood. I try to attempt a fix as soon as possible.

RTBC works for me.

timmillwood’s picture

Status: Needs review » Reviewed & tested by the community

If RTBC works for @mstef, lets do it!

plach’s picture

Why is this filed against 8.4.x?

plach’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs issue summary update

#49 and #50 make sense to me, but we need to update the IS to reflect the proposed solution.

Aside from that, I have a few nitpicks and questions:

  1. +++ b/core/modules/content_moderation/src/Plugin/Field/ModerationStateFieldItemList.php
    @@ -83,41 +113,6 @@ protected function loadContentModerationStateRevision(ContentEntityInterface $en
    -  public function get($index) {
    -    if ($index !== 0) {
    -      throw new \InvalidArgumentException('An entity can not have multiple moderation states at the same time.');
    -    }
    

    Shouldn't we keep throwing this exception and invoke the parent (trait) method after this check is performed?

  2. +++ b/core/modules/content_moderation/tests/src/Kernel/ModerationStateFieldItemListTest.php
    @@ -79,6 +79,27 @@ public function testArrayIteration() {
    +   * Test getting the moderation_state with getValue.
    

    "Tests"

    Also can we prefix the method name with :: to improve readability?

  3. +++ b/core/modules/content_moderation/tests/src/Kernel/ModerationStateFieldItemListTest.php
    @@ -79,6 +79,27 @@ public function testArrayIteration() {
    +   * Test setting an empty value on the moderation_state field.
    

    "Tests"

timmillwood’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
2.26 KB
5.74 KB

Adding get() back so we can have the exception, and adding a test for it.

plach’s picture

Thanks! Can we please update also the IS?

Sam152’s picture

Issue summary: View changes
Issue tags: -Needs issue summary update

Updated IS.

plach’s picture

Version: 8.4.x-dev » 8.5.x-dev

This will have to go in 8.5.x first.

Sam152’s picture

Good point, forgot to update that. Queueing a test against 8.5.

timmillwood’s picture

In the follow up to this (#2927455: When adding a new translation the entity should start from the draft state) I changed direction a little to force all new translations to start from the initial unpublished state (draft). Much like how we force new entities to start from the initial unpublished state. However this may see the return of the invalid transition issue shown in #48.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 55: 2915398-55.patch, failed testing. View results

Sam152’s picture

Status: Needs work » Reviewed & tested by the community

Fail is an issue with CI.

Wim Leers’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/core/modules/content_moderation/src/Plugin/Field/ModerationStateFieldItemList.php
    @@ -14,6 +15,36 @@
    +    get as traitGet;
    
    @@ -90,32 +121,7 @@ public function get($index) {
         if ($index !== 0) {
           throw new \InvalidArgumentException('An entity can not have multiple moderation states at the same time.');
         }
    ...
    +    return $this->traitGet($index);
    

    ❤️

  2. +++ b/core/modules/content_moderation/src/Plugin/Field/ModerationStateFieldItemList.php
    @@ -14,6 +15,36 @@
    +    // Do not store NULL values in the static cache.
    +    if ($moderation_state) {
    ...
    +    // If the moderation state field is set to an empty value, always recompute
    +    // the state. Empty is not a valid moderation state value, when none is
    +    // preset the default state is used.
    +    if (!isset($this->list[0]) || $this->list[0]->isEmpty()) {
    

    This means these two methods are collaborating in a subtle way.

    It's only thanks to computeValue() conditionally setting $this->list[0] that ensureComputedValue()'s comment makes sense: always recompute the state.

    Also, when none is is preset the default state is used is not very clear: where is this default state then set? It's not happening here? (Should it be present btw?)

    Finally, I wonder if it's be clearer to move this to after the $this->traitEnsureComputedValue() call? Because then it'd be clear we'd instantly "forgetting" what we just computed.

  3. +++ b/core/modules/content_moderation/tests/src/Kernel/ModerationStateFieldItemListTest.php
    @@ -79,6 +79,36 @@ public function testArrayIteration() {
    +   * Tests getting the moderation_state with getValue.
    

    @covers ::getValue

  4. +++ b/core/modules/content_moderation/tests/src/Kernel/ModerationStateFieldItemListTest.php
    @@ -79,6 +79,36 @@ public function testArrayIteration() {
    +   * Tests getting the moderation_state with get.
    

    @covers ::get

  5. +++ b/core/modules/content_moderation/tests/src/Kernel/ModerationStateFieldItemListTest.php
    @@ -79,6 +79,36 @@ public function testArrayIteration() {
    +   * Tests setting an empty value on the moderation_state field.
    

    @covers ::set + @dataProvider would be better

Sam152’s picture

2. I'm not sure these two methods are that related. Not sure if this explanation clears anything up.

ensureComputedValue: This exists to preserve some existing idosyncratic behavior with how the computed worked before the trait was introduced, @see this described in #31. I think the key thing is the field item list can be set to an empty value completely outside of "computing" of the field (core does this in entity forms). Ie, I can go $entity->computed = '';. Normally this would probably be valid, but in the case of CM, things don't place nice.
computeValue: The null check here is purely based around entities belonging to bundles that may not have moderation applied to them. It looks like it was introduced way back in #11 and simply moved from the original compute value method. Testing if we really need it in 2915398-64_REMOVED_NULL_CHECK_IN_COMPUTE_VALUE.patch (inter-interdiff.txt). Hopefully this indicates why this exists, or gives us the nod to remove it.

As for rearranging, the trait method reads from $this->valueComputed, so not sure that would work.
3. Fixed!
4. Fixed!
5. What would go in the data provider? We're setting the value on two different objects and using an unset. Tried to update the comment to be a bit clearer.

Edit: Also right about preset/present. Will wait for some test runs before addressing that.

Status: Needs review » Needs work
Sam152’s picture

Status: Needs work » Needs review
FileSize
2.77 KB
6.58 KB

So I think what #64 has exposed is:

For entities not under moderation, $entity->moderation_state can exist in a state of having zero list items. So it goes a little beyond what the comment indicates, it's not only about the static cache. With inter-interdiff applied, empty and null list items can be assigned during the normal lifecycle of a non-moderated entity and the field will essentially have a value for a non moderated entity.

If that's the route everyone is happy to go down (which I think makes the most sense), I've added an explicit test for this, tried to clarify the comment on the method and also fixed preset/present.

I think this addresses everything raised so far.

timmillwood’s picture

Status: Needs review » Reviewed & tested by the community

@Wim Leers - thanks for the review
@Sam152 - thanks for fixing these points.

Back to RTBC.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

catch’s picture

Version: 8.6.x-dev » 8.5.x-dev
Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.6.x and cherry-picked to 8.5.x. Thanks!

Version: 8.5.x-dev » 8.6.x-dev
Status: Fixed » Reviewed & tested by the community
  • catch committed 56247da on 8.6.x
    Issue #2915398 by Sam152, amateescu, timmillwood, plach, mstef: The...

  • catch committed 5e69700 on 8.5.x
    Issue #2915398 by Sam152, amateescu, timmillwood, plach, mstef: The...
catch’s picture

Version: 8.6.x-dev » 8.5.x-dev
Status: Reviewed & tested by the community » Fixed
penyaskito’s picture

Since this commit, adding a new translation via API forces that a new revision is added, instead of adding a new translation to the existing revision, which is making the Lingotek automated tests fail (we were actually ensuring the translation was done in the existing revision).
Is this on purpose?

plach’s picture

@penyaskito:

We are talking about moderated entities, right? I don't think this was on purpose, but I thought any save of a moderated entity was already triggering the creation of a new revision.

Status: Fixed » Closed (fixed)

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