Repository navigation
fix: preserve localized status when restoring global drafts - #19161
DanRibbens wants to merge 1 commit into
Conversation
Written with AI
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Set localized draft status packages/payload/src/globals/operations/restoreVersion.ts, test/versions/restore-localized-global.int.spec.ts |
When localization and localized status are enabled, restoration sets _status to draft for each configured locale. Otherwise, it sets _status to the string draft. The integration test checks localized statuses, restored titles, and the unchanged published English title and status. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related issues
- Explore restoring all document versions as drafts by default #18926: The issue concerns restoring a version as a draft while leaving the published document unchanged; this PR tests that outcome for a localized global.
Possibly related PRs
- payloadcms/payload#17394: Changes localized draft-status handling in global updates, using the same locale-keyed status representation.
- payloadcms/payload#19104: Covers the same localized draft-status behavior in global version restoration.
- payloadcms/payload#18892: Changes the admin restore action to restore draft-enabled globals as drafts; this PR addresses localized status handling in the global restore operation.
Suggested reviewers: jarrodmflesch
Merge Risk: 
Minimal · up to d4728
-
The change assigns draft status per locale. No merge-blocking issue has been established.
Security architecture risk: 
Minimal · up to d4728
-
The change restores the expected per-locale draft status without adding entrypoints, increasing privileges, or changing how published globals are written. No material security risk introduced or worsened by this PR was identified.
Retained concerns
No architecture-level concerns identified.Security review details
-
Security Blast Radius
- inferred — The changed outcome is bounded to draft restoration of the selected global version across that global's configured locales. The inspected caller and persistence paths do not introduce additional service, credential, or data-store authority.
Trust Boundaries and Controls
- observed — Version selection remains constrained by read-version access. Update authorization remains mandatory unless the existing overrideAccess option is used, and any returned update constraints are checked before persistence. The PR does not alter these controls.
Resilience and Maintainability Implications
- observed — The existing transition saves the version and runs post-read and post-change hooks before committing a transaction it owns; caught failures invoke transaction cleanup. Repeated restores continue to create versions rather than deduplicate requests. These mechanisms are unchanged; adapter isolation and rollback of external hook effects were not verified.
-
Pre-merge checks: 
5
-
Full details: Docstring Coverage
-
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files.
-
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
📦 esbuild Bundle Analysis for payloadThis analysis was generated by esbuild-bundle-analyzer. 🤖
Largest pathsThese visualization shows top 20 largest paths in the bundle.Meta file: packages/next/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_shared.json, Out file: esbuild/exports/shared.js
Meta file: packages/richtext-lexical/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_shared.json, Out file: esbuild/exports/shared_optimized/index.js
DetailsNext to the size is how much the size has increased or decreased compared with the base branch of this PR.
|
|
Pretty sure this was already fixed in #18928. Global restoration now calls |
|
This was already fixed by #18928 |
Written with AI
Description
Restoring a global as a draft must keep localized
_statusas an object and set every locale to draft. Preserve the published global. The test exercises the existing draft-capable restore operation; the Local API wrapper does not expose a draft option.Extracted from #19104. This PR targets
mainand can merge independently of the content branching stack and the other extracted PRs.Changes
This PR contains only the standalone behavior and its focused regression coverage. The content branching stack inherits this change through its prerequisite branch instead of duplicating the implementation.
Test Plan
pnpm lintpassed with existing repository warnings.pnpm exec oxfmt --write.