dotCMS / dotCMS/core

refactor(push-publish): single definition of the RemotePublishAjaxAction form body

Open Beginner friendly
#37,090 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

dotCMS : Push Publishing Team : Scout Type : Refactoring
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:

  • datesDate-ish then formatted via DotFormatDateService, vs already split into yyyy-MM-dd / HH-mm
  • whoToSendstring[] joined, vs a pre-joined string
  • action field namepushActionSelected vs iWantTo

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
  • pushPublishContent and pushPublishAssets both route through it via their own shape-adapters
  • The six existing exact-body-string assertions in push-publish.service.spec.ts pass 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
  • filterKey is still omitted entirely (not sent empty) when unset — the servlet reads it straight into getFilterDescriptorByKey
  • Every value is still encodeURIComponent-escaped, including filterKey, timezoneId, iWantTo and whoToSend
  • bundleName= and bundleSelect= are still sent empty — a value there diverts the push into a bundle instead of sending it
  • pushPublishContent's isBundle branch still selects cmd/pushBundle vs cmd/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, lint and format:check clean
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 screens
  • apps/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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.