-
-
Notifications
You must be signed in to change notification settings - Fork 0
Scoped the content authoring API moderation policy to entity creation so drafts can be published. #245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+117
−1
Merged
Scoped the content authoring API moderation policy to entity creation so drafts can be published. #245
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
c54ff6f
Scoped the content authoring API moderation policy to entity creation.
AlexSkrypnyk 172b002
Fixed line-length warning in 'ModerationPolicyHook' comment.
AlexSkrypnyk f216a6e
Added phpstan-ignore annotation to 'contentShouldBePublished' step.
AlexSkrypnyk d5ff521
Addressed code review: added a companion media update-after-authoring…
AlexSkrypnyk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| @api | ||
| Feature: Publishing API-authored content through the editorial UI | ||
|
|
||
| As a reviewer who also holds the content authoring API permission | ||
| I want to publish a draft page through the editorial UI | ||
| So that content authored through the API can be reviewed and go live | ||
|
|
||
| Scenario: An account with the content authoring API permission publishes a draft page | ||
| Given I am logged in as a user with the "access content, access administration pages, access content overview, edit any civictheme_page content, view any unpublished content, use content authoring api, use civictheme_editorial transition create_new_draft, use civictheme_editorial transition publish" permissions | ||
| And the following "civictheme_page" content: | ||
| | title | moderation_state | field_c_n_banner_type | field_c_n_banner_theme | field_c_n_banner_blend_mode | field_c_n_vertical_spacing | | ||
| | API draft to publish | draft | large | inherit | normal | both | | ||
| When I visit the "civictheme_page" content edit page with the title "API draft to publish" | ||
| And I select "Published" from "moderation_state[0][state]" | ||
| And I press "Save" | ||
| Then the "civictheme_page" content "API draft to publish" should be published |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win
Missing test coverage for media update-after-authoring.
Given the guard in
ModerationPolicyHook::entityPresave()(Line 53-55 of that file) applies to both the node and media branches, consider adding a companion test asserting the expected behavior when an API-authored media entity'smoderation_stateis changed on a subsequent update — this exercises the concern raised inModerationPolicyHook.php.🧰 Tools
🪛 PHPMD (2.15.0)
[error] 189-193: Avoid using static access to class '\Drupal\node\Entity\Node' in method 'testApiPagePublishAfterAuthoringIsHonoured'. (undefined)
(StaticAccess)
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in d5ff521. Added testApiMediaUpdateAfterAuthoringIsHonoured, which authors a media (coerced to published on create) then updates it to draft and asserts the later change is honoured - covering the media branch of the isNew guard alongside the node test.