refactor(push-publish): single definition of the RemotePublishAjaxAction form body
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 970
- Forks
- 486
- Avg merge
- 3d 33m
- Merged PRs (30d)
- 170
Description
Description
PushPublishService now builds the same form-urlencoded body for RemotePublishAjaxAction/cmd/publish in two places:
| Input shape | Added | |
|---|---|---|
pushPublishAssets |
DotWorkflowPushPublishValue — dates already split |
#37080 / PR #37081 |
getPublishEnvironmentData (private, used by pushPublishContent) |
DotPushPublishData — whole dates |
pre-existing |
The parameter list is identical in set and order in both:
assetIdentifier · remotePublishDate · remotePublishTime · remotePublishExpireDate
remotePublishExpireTime · timezoneId · iWantTo · whoToSend · bundleName= · bundleSelect= · filterKey?
Only the input shapes differ:
- dates —
Date-ish then formatted viaDotFormatDateService, vs already split intoyyyy-MM-dd/HH-mm whoToSend—string[]joined, vs a pre-joined string- action field name —
pushActionSelectedvsiWantTo
Raised in review: https://github.com/dotCMS/core/pull/37081#discussion_r3798668376
Proposed shape (non-binding): a private post(assetIdentifier, params) holding the single definition of the servlet's contract, with two thin shape-adapters in front of it — keeping the date derivation inside the adapter that needs it.
This is a pure refactor. No behaviour change, no wire-format change.
Why it was not done in PR #37081: it modifies a shared service with two production callers outside that PR's feature area, so bundling it would have made a quick-actions reviewer implicitly sign off on the content-types listing and the push publish dialog.
Acceptance Criteria
- The eleven-parameter body has exactly one definition in
push-publish.service.ts -
pushPublishContentandpushPublishAssetsboth route through it via their own shape-adapters - The six existing exact-body-string assertions in
push-publish.service.spec.tspass unchanged — the wire format is byte-identical for both callers - The
publishDate ? new Date(publishDate) : new Date()fallback-to-now is preserved for all four date/time parameters -
filterKeyis still omitted entirely (not sent empty) when unset — the servlet reads it straight intogetFilterDescriptorByKey - Every value is still
encodeURIComponent-escaped, includingfilterKey,timezoneId,iWantToandwhoToSend -
bundleName=andbundleSelect=are still sent empty — a value there diverts the push into a bundle instead of sending it -
pushPublishContent'sisBundlebranch still selectscmd/pushBundlevscmd/publish - Manual QA: push publish a content type from the content types listing reaches the target environment
- Manual QA: push publish a single contentlet from the push publish dialog reaches the target environment
- Manual QA: push publish a multi-item selection from Content Drive quick actions still works
-
pnpm nx test data-access,lintandformat:checkclean
Priority
Low
Additional Context
Scope: core-web/libs/data-access/src/lib/push-publish/push-publish.service.ts only.
Estimate: ~30–45 min, net roughly −20 lines.
Risk — two production callers outside Content Drive must be exercised before merge:
apps/dotcms-ui/src/app/view/components/_common/dot-push-publish-dialog/dot-push-publish-dialog.component.ts— the single-item push publish dialog, reached from many screensapps/dotcms-ui/src/app/portlets/shared/dot-content-types-listing/dot-content-types.component.ts— push publish a content type from the listing
Neither is covered by Content Drive tests.
The subtle part is the date-defaulting branch, repeated four times. The silent fallback-to-now must not change — that is where a mechanical extraction is most likely to drift.
Main safety net: the six exact-body-string assertions pin the wire format. For a pure string builder these are the strongest available regression detector; any drift fails loudly and points at the character.
Out of scope: the equivalent duplication at the store layer (executeAddToBundle / executePushPublish) was already collapsed onto fireLegacyServletBulk in PR #37081.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in core-web/libs/data-access/src/lib/push-publish/push-publish.service.ts and review the six exact-body-string assertions in push-publish.service.spec.ts alongside both existing publish paths. Done means one shared eleven-parameter body definition preserves date fallbacks, escaping, optional filterKey, and bundle branching; run pnpm nx test data-access, lint, and format:check, then perform the listed manual QA.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, frontend
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100