Problem/Motivation

When using content moderation there is not state defined to set when promoting an item.

Proposed resolution

Set moderation state to published so paragraph status can be managed inline.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

yongt9412 created an issue. See original summary.

johnchque’s picture

Status: Active » Needs review
StatusFileSize
new798 bytes

This seems to work.

berdir’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

\Drupal\Tests\paragraphs_library\FunctionalJavascript\ParagraphsContentModerationTest is a test that tests library items with content moderation enabled. We might be abe to extend that with a test method to test this?

johnchque’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
StatusFileSize
new3.06 KB
new3.84 KB
new2.86 KB

Adding tests. BTW I just noticed that we are using the old widget in the tests. I believe that this should not make much difference.

The last submitted patch, 4: 3159902-promoted-items-state-4-TEST-ONLY.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Status: Needs review » Needs work

The last submitted patch, 4: 3159902-promoted-items-state-4.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

johnchque’s picture

Status: Needs work » Needs review
StatusFileSize
new4.12 KB
new4.9 KB
new1.38 KB

Sorry, this should fix the tests. :)

The last submitted patch, 7: 3159902-promoted-items-state-6-TEST-ONLY.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

berdir’s picture

Status: Needs review » Needs work
+++ b/modules/paragraphs_library/tests/src/FunctionalJavascript/ParagraphsContentModerationTest.php
@@ -421,6 +423,28 @@ class ParagraphsContentModerationTest extends WebDriverTestBase {
+    $add_above_button = $assert_session->elementExists('css', 'input[name="field_paragraphs_0_promote_to_library"]', $first_row);
+    $add_above_button->click();
+    drupal_flush_all_caches();
+    $library_item = $this->getLastEntityOfType('paragraphs_library_item', TRUE);
+    $this->assertEquals('published', $library_item->moderation_state->value);

dfac() shouldn't be required here, this is creating a new entity that can't be cached yet.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new4.87 KB
new906 bytes

I removed it and the test passes for me locally, lets see about testbot.

berdir’s picture

Status: Needs review » Fixed

Testbot is happy too.

  • Berdir committed d39f661 on 8.x-1.x
    Issue #3159902 by yongt9412, Berdir: Set newly promoted library items to...

Status: Fixed » Closed (fixed)

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