Elements: Support create-and-publish and update-and-publish as a single operation - #23277
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
…shing elements this mirrors what is done in the document-publishing.workspace-context.ts
|
Claude finished @iOvergaard's task in 9m 11s —— View job PR ReviewTarget: Extends the "save-and-publish as a single operation" capability — introduced for documents in #22812 — to elements by promoting
Suggestions
Approved with Suggestions for improvementGood to go. The architecture is sound — |
iOvergaard
left a comment
There was a problem hiding this comment.
Tested and approved from a frontend perspective. Aligned a few calls with the document-publishing context, which seems to have been implemented as the v18 work was ongoing (validateAndSubmit vs validateVariantsAndSubmit where we now use the latter).
# Conflicts: # src/Umbraco.Web.UI.Client/src/packages/core/backend-api/index.ts # src/Umbraco.Web.UI.Client/src/packages/core/backend-api/sdk.gen.ts # src/Umbraco.Web.UI.Client/src/packages/elements/publishing/repository/element-publishing.server.data-source.ts # src/Umbraco.Web.UI.Client/src/packages/elements/repository/detail/element-detail.server.data-source.ts # src/Umbraco.Web.UI.Client/src/packages/elements/workspace/element-workspace-split-view-variant-selector.element.ts
|



Description
This applies the "save and publish as a single operation" capability — introduced for documents in #22812 — to elements.
Background
#22812 introduced atomic create-and-publish and update-and-publish operations for documents, so the backoffice can create/update and publish in a single server round-trip rather than a save followed by a separate publish call. It added:
IContentService.SaveAndPublish(...)with the underlying single-scope implementation.IContentEditingService.CreateAndPublishAsync/UpdateAndPublishAsync.CreateAndPublishDocumentController/UpdateAndPublishDocumentController(with an additional publish-permission check on top of create/update).createAndPublish/updateAndPublishdata-source methods, a shared request-body mapper, and a persist-strategy in the document publishing workspace context (replacing the old two-step save-then-publish), plus publish-failure notifications.Elements are a publishable content type built on the same content base classes as documents and support save-and-publish, but had not received this capability. This PR closes that gap.
Changes
Server (services)
SaveAndPublishto the sharedIPublishableContentService<T>(default implementation) andPublishableContentServiceBase<T>(real single-scope implementation), so both documents and elements inherit one implementation — aligning with howSave/Publish/Unpublishalready live on the base.CreateAndPublishAsync/UpdateAndPublishAsynctoIElementEditingService/ElementEditingService.Server (Management API)
CreateAndPublishElementController(POST …/create-and-publish) andUpdateAndPublishElementController(PUT …/{id}/update-and-publish), plus the corresponding request models. Both perform the additionalActionElementPublishauthorization check on top of create/update.Client (backoffice)
OpenApi.jsonand the typed API client for the new endpoints.element-detail-request.mappers.ts, combinedcreateAndPublish/updateAndPublishon the element publishing data-source and repository, and a persist-strategy rewrite of the element publishing workspace context.UmbPublishableSplitViewVariantSelectorElementbase class.Testing
Automated
Automated testing has been added for service and management APIs, aligned with documents and following the existing pattern of not being exhaustive when it's shared logic that's being tested.
Manual
en-US+da-DK).create-and-publishrequest is sent — not a save followed by a separate publish — and the element is created and published.{id}/update-and-publishrequest and that the change is published.