feat: adds restore as draft option to versions (#7100)
## Description Adds option to restore a version as a draft. 1. Run `versions` test suite 2. Go to `drafts` and choose any doc with `status: published` 3. Open the version 4. See new `restore as draft` option <img width="1693" alt="Screenshot 2024-07-12 at 1 01 17 PM" src="https://github.com/user-attachments/assets/14d4f806-c56c-46be-aa93-1a2bd04ffd5c"> - [X] I have read and understand the [CONTRIBUTING.md](https://github.com/payloadcms/payload/blob/main/CONTRIBUTING.md) document in this repository. ## Type of change - [ ] Chore (non-breaking change which does not add functionality) - [ ] Bug fix (non-breaking change which fixes an issue) - [X] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Change to the [templates](https://github.com/payloadcms/payload/tree/main/templates) directory (does not affect core functionality) - [ ] Change to the [examples](https://github.com/payloadcms/payload/tree/main/examples) directory (does not affect core functionality) - [ ] This change requires a documentation update ## Checklist: - [ ] I have added tests that prove my fix is effective or that my feature works - [X] Existing test suite passes locally with my changes - [ ] I have made corresponding changes to the documentation
This commit is contained in:
committed by
GitHub
parent
075819964d
commit
d307d627ab
@@ -64,7 +64,7 @@ export const findGlobalVersions: FindGlobalVersions = async function findGlobalV
|
||||
forceCountFn: hasNearConstraint,
|
||||
lean: true,
|
||||
leanWithId: true,
|
||||
offset: skip,
|
||||
limit,
|
||||
options,
|
||||
page,
|
||||
pagination,
|
||||
|
||||
@@ -7,6 +7,7 @@ import type { Context } from '../types.js'
|
||||
export type Resolver = (
|
||||
_: unknown,
|
||||
args: {
|
||||
draft?: boolean
|
||||
id: number | string
|
||||
},
|
||||
context: {
|
||||
@@ -20,6 +21,7 @@ export default function restoreVersionResolver(collection: Collection): Resolver
|
||||
id: args.id,
|
||||
collection,
|
||||
depth: 0,
|
||||
draft: args.draft,
|
||||
req: isolateObjectProperty(context.req, 'transactionID'),
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import type { Context } from '../types.js'
|
||||
type Resolver = (
|
||||
_: unknown,
|
||||
args: {
|
||||
draft?: boolean
|
||||
id: number | string
|
||||
},
|
||||
context: {
|
||||
@@ -18,6 +19,7 @@ export default function restoreVersionResolver(globalConfig: SanitizedGlobalConf
|
||||
const options = {
|
||||
id: args.id,
|
||||
depth: 0,
|
||||
draft: args.draft,
|
||||
globalConfig,
|
||||
req: isolateObjectProperty(context.req, 'transactionID'),
|
||||
}
|
||||
|
||||
@@ -342,6 +342,7 @@ function initCollectionsGraphQL({ config, graphqlResult }: InitCollectionsGraphQ
|
||||
type: collection.graphQL.type,
|
||||
args: {
|
||||
id: { type: versionIDType },
|
||||
draft: { type: GraphQLBoolean },
|
||||
},
|
||||
resolve: restoreVersionResolver(collection),
|
||||
}
|
||||
|
||||
@@ -133,6 +133,7 @@ function initGlobalsGraphQL({ config, graphqlResult }: InitGlobalsGraphQLArgs):
|
||||
type: graphqlResult.globals.graphQL[slug].versionType,
|
||||
args: {
|
||||
id: { type: idType },
|
||||
draft: { type: GraphQLBoolean },
|
||||
...(config.localization
|
||||
? {
|
||||
fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType },
|
||||
@@ -171,6 +172,7 @@ function initGlobalsGraphQL({ config, graphqlResult }: InitGlobalsGraphQLArgs):
|
||||
type: graphqlResult.globals.graphQL[slug].type,
|
||||
args: {
|
||||
id: { type: idType },
|
||||
draft: { type: GraphQLBoolean },
|
||||
},
|
||||
resolve: restoreVersionResolver(global),
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use client'
|
||||
import { useDocumentInfo } from '@payloadcms/ui'
|
||||
import React, { Fragment } from 'react'
|
||||
import React from 'react'
|
||||
|
||||
import { baseClass } from '../../Tab/index.js'
|
||||
|
||||
@@ -12,13 +12,14 @@ export const VersionsPill: React.FC = () => {
|
||||
// documents that are version enabled _always_ have at least one version
|
||||
const hasVersions = versions?.totalDocs > 0
|
||||
|
||||
return (
|
||||
<span
|
||||
className={[`${baseClass}__count`, hasVersions ? `${baseClass}__count--has-count` : '']
|
||||
.filter(Boolean)
|
||||
.join(' ')}
|
||||
>
|
||||
{hasVersions ? versions.totalDocs.toString() : <Fragment> </Fragment>}
|
||||
</span>
|
||||
)
|
||||
if (hasVersions)
|
||||
return (
|
||||
<span
|
||||
className={[`${baseClass}__count`, hasVersions ? `${baseClass}__count--has-count` : '']
|
||||
.filter(Boolean)
|
||||
.join(' ')}
|
||||
>
|
||||
{versions.totalDocs.toString()}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ export const restoreVersion: CollectionRouteHandlerWithID = async ({
|
||||
}) => {
|
||||
const { searchParams } = req
|
||||
const depth = searchParams.get('depth')
|
||||
const draft = searchParams.get('draft')
|
||||
|
||||
const id = sanitizeCollectionID({
|
||||
id: incomingID,
|
||||
@@ -25,6 +26,7 @@ export const restoreVersion: CollectionRouteHandlerWithID = async ({
|
||||
id,
|
||||
collection,
|
||||
depth: isNumber(depth) ? Number(depth) : undefined,
|
||||
draft: draft === 'true' ? true : undefined,
|
||||
req,
|
||||
})
|
||||
|
||||
|
||||
@@ -9,10 +9,12 @@ import { headersWithCors } from '../../../utilities/headersWithCors.js'
|
||||
export const restoreVersion: GlobalRouteHandlerWithID = async ({ id, globalConfig, req }) => {
|
||||
const { searchParams } = req
|
||||
const depth = searchParams.get('depth')
|
||||
const draft = searchParams.get('draft')
|
||||
|
||||
const doc = await restoreVersionOperationGlobal({
|
||||
id,
|
||||
depth: isNumber(depth) ? Number(depth) : undefined,
|
||||
draft: draft === 'true' ? true : undefined,
|
||||
globalConfig,
|
||||
req,
|
||||
})
|
||||
|
||||
@@ -111,6 +111,7 @@ export const DefaultVersionView: React.FC<DefaultVersionsViewProps> = ({
|
||||
globalSlug={globalSlug}
|
||||
label={collectionConfig?.labels.singular || globalConfig?.label}
|
||||
originalDocID={id}
|
||||
status={doc?.version?._status}
|
||||
versionDate={versionCreatedAt}
|
||||
versionID={versionID}
|
||||
/>
|
||||
|
||||
@@ -2,6 +2,37 @@
|
||||
|
||||
.restore-version {
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
|
||||
.popup-button {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
&__chevron {
|
||||
background-color: var(--theme-elevation-150);
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
cursor: pointer;
|
||||
|
||||
.stroke {
|
||||
stroke-width: 1px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: var(--theme-elevation-100);
|
||||
}
|
||||
}
|
||||
|
||||
&__button {
|
||||
border-top-right-radius: 0px;
|
||||
border-bottom-right-radius: 0px;
|
||||
margin-right: 2px;
|
||||
|
||||
&:focus {
|
||||
border-radius: 0;
|
||||
outline-offset: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&__modal {
|
||||
@include blur-bg;
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
'use client'
|
||||
import { getTranslation } from '@payloadcms/translations'
|
||||
import { Button, Modal, Pill, useConfig, useModal, useTranslation } from '@payloadcms/ui'
|
||||
import {
|
||||
Button,
|
||||
ChevronIcon,
|
||||
Modal,
|
||||
Pill,
|
||||
Popup,
|
||||
PopupList,
|
||||
useConfig,
|
||||
useModal,
|
||||
useTranslation,
|
||||
} from '@payloadcms/ui'
|
||||
import { formatAdminURL, requests } from '@payloadcms/ui/shared'
|
||||
import { useRouter } from 'next/navigation.js'
|
||||
import React, { Fragment, useCallback, useState } from 'react'
|
||||
@@ -20,6 +30,7 @@ const Restore: React.FC<Props> = ({
|
||||
globalSlug,
|
||||
label,
|
||||
originalDocID,
|
||||
status,
|
||||
versionDate,
|
||||
versionID,
|
||||
}) => {
|
||||
@@ -32,6 +43,7 @@ const Restore: React.FC<Props> = ({
|
||||
const [processing, setProcessing] = useState(false)
|
||||
const router = useRouter()
|
||||
const { i18n, t } = useTranslation()
|
||||
const [draft, setDraft] = useState(false)
|
||||
|
||||
const restoreMessage = t('version:aboutToRestoreGlobal', {
|
||||
label: getTranslation(label, i18n),
|
||||
@@ -40,9 +52,10 @@ const Restore: React.FC<Props> = ({
|
||||
|
||||
let fetchURL = `${serverURL}${apiRoute}`
|
||||
let redirectURL: string
|
||||
const canRestoreAsDraft = status !== 'draft'
|
||||
|
||||
if (collectionSlug) {
|
||||
fetchURL = `${fetchURL}/${collectionSlug}/versions/${versionID}`
|
||||
fetchURL = `${fetchURL}/${collectionSlug}/versions/${versionID}?draft=${draft}`
|
||||
redirectURL = formatAdminURL({
|
||||
adminRoute,
|
||||
path: `/collections/${collectionSlug}/${originalDocID}`,
|
||||
@@ -50,7 +63,7 @@ const Restore: React.FC<Props> = ({
|
||||
}
|
||||
|
||||
if (globalSlug) {
|
||||
fetchURL = `${fetchURL}/globals/${globalSlug}/versions/${versionID}`
|
||||
fetchURL = `${fetchURL}/globals/${globalSlug}/versions/${versionID}?draft=${draft}`
|
||||
redirectURL = formatAdminURL({
|
||||
adminRoute,
|
||||
path: `/globals/${globalSlug}`,
|
||||
@@ -74,15 +87,35 @@ const Restore: React.FC<Props> = ({
|
||||
toast.error(t('version:problemRestoringVersion'))
|
||||
}
|
||||
}, [fetchURL, redirectURL, t, i18n, router])
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<Pill
|
||||
className={[baseClass, className].filter(Boolean).join(' ')}
|
||||
onClick={() => toggleModal(modalSlug)}
|
||||
>
|
||||
{t('version:restoreThisVersion')}
|
||||
</Pill>
|
||||
<div className={[baseClass, className].filter(Boolean).join(' ')}>
|
||||
<Pill
|
||||
className={[canRestoreAsDraft && `${baseClass}__button`].filter(Boolean).join(' ')}
|
||||
onClick={() => toggleModal(modalSlug)}
|
||||
>
|
||||
{t('version:restoreThisVersion')}
|
||||
</Pill>
|
||||
{canRestoreAsDraft && (
|
||||
<Popup
|
||||
button={
|
||||
<Pill className={`${baseClass}__chevron`}>
|
||||
<ChevronIcon />
|
||||
</Pill>
|
||||
}
|
||||
caret={false}
|
||||
render={() => (
|
||||
<PopupList.ButtonGroup>
|
||||
<PopupList.Button onClick={() => [setDraft(true), toggleModal(modalSlug)]}>
|
||||
{t('version:restoreAsDraft')}
|
||||
</PopupList.Button>
|
||||
</PopupList.ButtonGroup>
|
||||
)}
|
||||
size="large"
|
||||
verticalAlign="bottom"
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<Modal className={`${baseClass}__modal`} slug={modalSlug}>
|
||||
<MinimalTemplate className={`${baseClass}__modal-template`}>
|
||||
<h1>{t('version:confirmVersionRestoration')}</h1>
|
||||
@@ -94,7 +127,7 @@ const Restore: React.FC<Props> = ({
|
||||
>
|
||||
{t('general:cancel')}
|
||||
</Button>
|
||||
<Button onClick={processing ? undefined : handleRestore}>
|
||||
<Button onClick={processing ? undefined : () => void handleRestore()}>
|
||||
{processing ? t('version:restoring') : t('general:confirm')}
|
||||
</Button>
|
||||
</MinimalTemplate>
|
||||
|
||||
@@ -6,6 +6,7 @@ export type Props = {
|
||||
globalSlug?: SanitizedGlobalConfig['slug']
|
||||
label: SanitizedCollectionConfig['labels']['singular']
|
||||
originalDocID: number | string
|
||||
status?: string
|
||||
versionDate: string
|
||||
versionID: string
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ export const VersionsViewClient: React.FC<{
|
||||
|
||||
const { getComponentMap } = useComponentMap()
|
||||
const { collectionSlug, globalSlug } = useDocumentInfo()
|
||||
const { data, handlePerPageChange } = useListQuery()
|
||||
const { data, handlePageChange, handlePerPageChange } = useListQuery()
|
||||
|
||||
const componentMap = getComponentMap({
|
||||
collectionSlug,
|
||||
@@ -59,6 +59,7 @@ export const VersionsViewClient: React.FC<{
|
||||
limit={data.limit}
|
||||
nextPage={data.nextPage}
|
||||
numberOfNeighbors={1}
|
||||
onChange={() => handlePageChange}
|
||||
page={data.page}
|
||||
prevPage={data.prevPage}
|
||||
totalPages={data.totalPages}
|
||||
@@ -73,7 +74,7 @@ export const VersionsViewClient: React.FC<{
|
||||
{i18n.t('general:of')} {data.totalDocs}
|
||||
</div>
|
||||
<PerPage
|
||||
handleChange={handlePerPageChange}
|
||||
handleChange={() => handlePerPageChange}
|
||||
limit={limit ? Number(limit) : 10}
|
||||
limits={paginationLimits}
|
||||
/>
|
||||
|
||||
@@ -18,6 +18,7 @@ export type Arguments = {
|
||||
currentDepth?: number
|
||||
depth?: number
|
||||
disableErrors?: boolean
|
||||
draft?: boolean
|
||||
id: number | string
|
||||
overrideAccess?: boolean
|
||||
req: PayloadRequest
|
||||
@@ -31,6 +32,7 @@ export const restoreVersionOperation = async <TData extends TypeWithID = any>(
|
||||
id,
|
||||
collection: { config: collectionConfig },
|
||||
depth,
|
||||
draft,
|
||||
overrideAccess = false,
|
||||
req,
|
||||
req: { fallbackLocale, locale, payload },
|
||||
@@ -126,7 +128,7 @@ export const restoreVersionOperation = async <TData extends TypeWithID = any>(
|
||||
parent: parentDocID,
|
||||
req,
|
||||
updatedAt: new Date().toISOString(),
|
||||
versionData: rawVersion.version,
|
||||
versionData: draft ? { ...rawVersion.version, _status: 'draft' } : rawVersion.version,
|
||||
})
|
||||
|
||||
// /////////////////////////////////////
|
||||
|
||||
@@ -17,6 +17,7 @@ export type Arguments = {
|
||||
limit?: number
|
||||
overrideAccess?: boolean
|
||||
page?: number
|
||||
pagination?: boolean
|
||||
req?: PayloadRequest
|
||||
showHiddenFields?: boolean
|
||||
sort?: string
|
||||
@@ -32,6 +33,7 @@ export const findVersionsOperation = async <T extends TypeWithVersion<T>>(
|
||||
limit,
|
||||
overrideAccess,
|
||||
page,
|
||||
pagination = true,
|
||||
req: { fallbackLocale, locale, payload },
|
||||
req,
|
||||
showHiddenFields,
|
||||
@@ -69,6 +71,7 @@ export const findVersionsOperation = async <T extends TypeWithVersion<T>>(
|
||||
limit: limit ?? 10,
|
||||
locale,
|
||||
page: page || 1,
|
||||
pagination,
|
||||
req,
|
||||
sort,
|
||||
where: fullWhere,
|
||||
|
||||
@@ -12,6 +12,7 @@ import { killTransaction } from '../../utilities/killTransaction.js'
|
||||
|
||||
export type Arguments = {
|
||||
depth?: number
|
||||
draft?: boolean
|
||||
globalConfig: SanitizedGlobalConfig
|
||||
id: number | string
|
||||
overrideAccess?: boolean
|
||||
@@ -25,6 +26,7 @@ export const restoreVersionOperation = async <T extends TypeWithVersion<T> = any
|
||||
const {
|
||||
id,
|
||||
depth,
|
||||
draft,
|
||||
globalConfig,
|
||||
overrideAccess,
|
||||
req: { fallbackLocale, locale, payload },
|
||||
@@ -63,6 +65,11 @@ export const restoreVersionOperation = async <T extends TypeWithVersion<T> = any
|
||||
// Patch globalType onto version doc
|
||||
rawVersion.version.globalType = globalConfig.slug
|
||||
|
||||
// Overwrite draft status if draft is true
|
||||
|
||||
if (draft) {
|
||||
rawVersion.version._status = 'draft'
|
||||
}
|
||||
// /////////////////////////////////////
|
||||
// fetch previousDoc
|
||||
// /////////////////////////////////////
|
||||
@@ -90,6 +97,18 @@ export const restoreVersionOperation = async <T extends TypeWithVersion<T> = any
|
||||
data: result,
|
||||
req,
|
||||
})
|
||||
|
||||
const now = new Date().toISOString()
|
||||
|
||||
result = await payload.db.createGlobalVersion({
|
||||
autosave: false,
|
||||
createdAt: result.createdAt ? new Date(result.createdAt).toISOString() : now,
|
||||
globalSlug: globalConfig.slug,
|
||||
parent: id,
|
||||
req,
|
||||
updatedAt: draft ? now : new Date(result.updatedAt).toISOString(),
|
||||
versionData: result,
|
||||
})
|
||||
} else {
|
||||
result = await payload.db.createGlobal({
|
||||
slug: globalConfig.slug,
|
||||
|
||||
@@ -314,6 +314,7 @@ export const clientTranslationKeys = createClientTranslationKeys([
|
||||
'version:publishChanges',
|
||||
'version:published',
|
||||
'version:publishing',
|
||||
'version:restoreAsDraft',
|
||||
'version:restoredSuccessfully',
|
||||
'version:restoreThisVersion',
|
||||
'version:restoring',
|
||||
|
||||
@@ -396,6 +396,7 @@ export const arTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: 'نشر التّغييرات',
|
||||
published: 'تمّ النّشر',
|
||||
publishing: 'نشر',
|
||||
restoreAsDraft: 'استعادة كمسودة',
|
||||
restoreThisVersion: 'استعادة هذه النّسخة',
|
||||
restoredSuccessfully: 'تمّت الاستعادة بنحاح.',
|
||||
restoring: 'تتمّ الاستعادة...',
|
||||
|
||||
@@ -403,6 +403,7 @@ export const azTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: 'Dəyişiklikləri dərc et',
|
||||
published: 'Dərc edilmiş',
|
||||
publishing: 'Nəşr',
|
||||
restoreAsDraft: 'Qaralamalar kimi bərpa et',
|
||||
restoreThisVersion: 'Bu versiyanı bərpa et',
|
||||
restoredSuccessfully: 'Uğurla bərpa edildi.',
|
||||
restoring: 'Bərpa olunur...',
|
||||
|
||||
@@ -402,6 +402,7 @@ export const bgTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: 'Публикувай промените',
|
||||
published: 'Публикувано',
|
||||
publishing: 'Публикуване',
|
||||
restoreAsDraft: 'Възстанови като чернова',
|
||||
restoreThisVersion: 'Възстанови тази версия',
|
||||
restoredSuccessfully: 'Успешно възстановяване.',
|
||||
restoring: 'Възстановяване...',
|
||||
|
||||
@@ -401,6 +401,7 @@ export const csTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: 'Publikovat změny',
|
||||
published: 'Publikováno',
|
||||
publishing: 'Publikování',
|
||||
restoreAsDraft: 'Obnovit jako koncept',
|
||||
restoreThisVersion: 'Obnovit tuto verzi',
|
||||
restoredSuccessfully: 'Úspěšně obnoveno.',
|
||||
restoring: 'Obnovování...',
|
||||
|
||||
@@ -407,6 +407,7 @@ export const deTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: 'Änderungen veröffentlichen',
|
||||
published: 'Veröffentlicht',
|
||||
publishing: 'Veröffentlichung',
|
||||
restoreAsDraft: 'Als Entwurf wiederherstellen',
|
||||
restoreThisVersion: 'Diese Version wiederherstellen',
|
||||
restoredSuccessfully: 'Erfolgreich wiederhergestellt.',
|
||||
restoring: 'Wiederherstellen...',
|
||||
|
||||
@@ -405,6 +405,7 @@ export const enTranslations = {
|
||||
publishChanges: 'Publish changes',
|
||||
published: 'Published',
|
||||
publishing: 'Publishing',
|
||||
restoreAsDraft: 'Restore as draft',
|
||||
restoreThisVersion: 'Restore this version',
|
||||
restoredSuccessfully: 'Restored Successfully.',
|
||||
restoring: 'Restoring...',
|
||||
|
||||
@@ -407,6 +407,7 @@ export const esTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: 'Publicar cambios',
|
||||
published: 'Publicado',
|
||||
publishing: 'Publicación',
|
||||
restoreAsDraft: 'Restaurar como borrador',
|
||||
restoreThisVersion: 'Restaurar esta versión',
|
||||
restoredSuccessfully: 'Restaurado éxito.',
|
||||
restoring: 'Restaurando...',
|
||||
|
||||
@@ -400,6 +400,7 @@ export const faTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: 'انتشار تغییرات',
|
||||
published: 'انتشار یافته',
|
||||
publishing: 'انتشار',
|
||||
restoreAsDraft: 'بازیابی به عنوان پیشنویس',
|
||||
restoreThisVersion: 'این نگارش را بازیابی کنید',
|
||||
restoredSuccessfully: 'با موفقیت بازیابی شد.',
|
||||
restoring: 'در حال بازیابی...',
|
||||
|
||||
@@ -342,7 +342,7 @@ export const frTranslations: DefaultTranslationsObject = {
|
||||
height: 'Hauteur',
|
||||
lessInfo: 'Moins d’infos',
|
||||
moreInfo: 'Plus d’infos',
|
||||
pasteURL: `Coller l'URL`,
|
||||
pasteURL: "Coller l'URL",
|
||||
previewSizes: 'Tailles d’aperçu',
|
||||
selectCollectionToBrowse: 'Sélectionnez une collection à parcourir',
|
||||
selectFile: 'Sélectionnez un fichier',
|
||||
@@ -414,6 +414,7 @@ export const frTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: 'Publier les modifications',
|
||||
published: 'Publié',
|
||||
publishing: 'Publication',
|
||||
restoreAsDraft: 'Restaurer comme brouillon',
|
||||
restoreThisVersion: 'Restaurer cette version',
|
||||
restoredSuccessfully: 'Restauré(e) avec succès.',
|
||||
restoring: 'Restauration en cours...',
|
||||
|
||||
@@ -390,6 +390,7 @@ export const heTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: 'פרסם שינויים',
|
||||
published: 'פורסם',
|
||||
publishing: 'מפרסם',
|
||||
restoreAsDraft: 'שחזר כטיוטה',
|
||||
restoreThisVersion: 'שחזר גרסה זו',
|
||||
restoredSuccessfully: 'שוחזר בהצלחה.',
|
||||
restoring: 'משחזר...',
|
||||
|
||||
@@ -400,6 +400,7 @@ export const hrTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: 'Objavi promjene',
|
||||
published: 'Objavljeno',
|
||||
publishing: 'Objavljivanje',
|
||||
restoreAsDraft: 'Vrati kao skicu',
|
||||
restoreThisVersion: 'Vrati ovu verziju',
|
||||
restoredSuccessfully: 'Uspješno vraćeno.',
|
||||
restoring: 'Vraćanje...',
|
||||
|
||||
@@ -407,6 +407,7 @@ export const huTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: 'Módosítások közzététele',
|
||||
published: 'Közzétett',
|
||||
publishing: 'Közzététel',
|
||||
restoreAsDraft: 'Visszaállítás piszkozatként',
|
||||
restoreThisVersion: 'A verzió visszaállítása',
|
||||
restoredSuccessfully: 'Sikeresen visszaállítva.',
|
||||
restoring: 'Visszaállítás...',
|
||||
|
||||
@@ -406,6 +406,7 @@ export const itTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: 'Pubblica modifiche',
|
||||
published: 'Pubblicato',
|
||||
publishing: 'Pubblicazione',
|
||||
restoreAsDraft: 'Ripristina come bozza',
|
||||
restoreThisVersion: 'Ripristina questa versione',
|
||||
restoredSuccessfully: 'Ripristinato con successo.',
|
||||
restoring: 'Ripristino...',
|
||||
|
||||
@@ -401,6 +401,7 @@ export const jaTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: '変更内容を公開',
|
||||
published: '公開済み',
|
||||
publishing: '公開',
|
||||
restoreAsDraft: '下書きとして復元',
|
||||
restoreThisVersion: 'このバージョンを復元',
|
||||
restoredSuccessfully: '正常に復元されました。',
|
||||
restoring: '復元しています...',
|
||||
|
||||
@@ -397,6 +397,7 @@ export const koTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: '변경 사항 게시',
|
||||
published: '게시됨',
|
||||
publishing: '게시',
|
||||
restoreAsDraft: '임시 저장으로 복원',
|
||||
restoreThisVersion: '이 버전 복원',
|
||||
restoredSuccessfully: '복원이 완료되었습니다.',
|
||||
restoring: '복원 중...',
|
||||
|
||||
@@ -409,6 +409,7 @@ export const myTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: 'အပြောင်းအလဲများကို တင်ခဲ့သည်။',
|
||||
published: 'တင်ပြီးပြီ။',
|
||||
publishing: 'ထုတ်ဝေခြင်း',
|
||||
restoreAsDraft: 'Pulihkan sebagai draf',
|
||||
restoreThisVersion: 'ဤဗားရှင်းကိုကို ပြန်ယူမည်။',
|
||||
restoredSuccessfully: 'အောင်မြင်စွာ ပြန်လည်ရယူခဲ့သည်။',
|
||||
restoring: 'ပြန်ယူနေဆဲ...',
|
||||
|
||||
@@ -403,6 +403,7 @@ export const nbTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: 'Publiser endringer',
|
||||
published: 'Publisert',
|
||||
publishing: 'Publisering',
|
||||
restoreAsDraft: 'Gjenopprett som utkast',
|
||||
restoreThisVersion: 'Gjenopprett denne versjonen',
|
||||
restoredSuccessfully: 'Gjenopprettet.',
|
||||
restoring: 'Gjenoppretter...',
|
||||
|
||||
@@ -406,6 +406,7 @@ export const nlTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: 'Publiceer wijzigingen',
|
||||
published: 'Gepubliceerd',
|
||||
publishing: 'Publicatie',
|
||||
restoreAsDraft: 'Herstellen als concept',
|
||||
restoreThisVersion: 'Herstel deze versie',
|
||||
restoredSuccessfully: 'Herstelling succesvol.',
|
||||
restoring: 'Herstellen...',
|
||||
|
||||
@@ -403,6 +403,7 @@ export const plTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: 'Opublikuj zmiany',
|
||||
published: 'Opublikowano',
|
||||
publishing: 'Publikacja',
|
||||
restoreAsDraft: 'Przywróć jako szkic',
|
||||
restoreThisVersion: 'Przywróć tę wersję',
|
||||
restoredSuccessfully: 'Przywrócono pomyślnie.',
|
||||
restoring: 'Przywracanie...',
|
||||
|
||||
@@ -404,6 +404,7 @@ export const ptTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: 'Publicar alterações',
|
||||
published: 'Publicado',
|
||||
publishing: 'Publicação',
|
||||
restoreAsDraft: 'Restaurar como rascunho',
|
||||
restoreThisVersion: 'Restaurar essa versão',
|
||||
restoredSuccessfully: 'Restaurado com sucesso.',
|
||||
restoring: 'Restaurando...',
|
||||
|
||||
@@ -411,6 +411,7 @@ export const roTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: 'Publicați modificările',
|
||||
published: 'Publicat',
|
||||
publishing: 'Editare',
|
||||
restoreAsDraft: 'Restaurează ca proiect',
|
||||
restoreThisVersion: 'Restaurați această versiune',
|
||||
restoredSuccessfully: 'Restaurat cu succes.',
|
||||
restoring: 'Restaurare...',
|
||||
|
||||
@@ -398,6 +398,7 @@ export const rsTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: 'Објави промене',
|
||||
published: 'Објављено',
|
||||
publishing: 'Objavljivanje',
|
||||
restoreAsDraft: 'Vrati kao nacrt',
|
||||
restoreThisVersion: 'Врати ову верзију',
|
||||
restoredSuccessfully: 'Успешно враћено.',
|
||||
restoring: 'Враћање...',
|
||||
|
||||
@@ -399,6 +399,7 @@ export const rsLatinTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: 'Objavljivanje',
|
||||
published: 'Objavljeno',
|
||||
publishing: 'Objavljivanje',
|
||||
restoreAsDraft: 'Vrati kao nacrt',
|
||||
restoreThisVersion: 'Vrati ovu verziju',
|
||||
restoredSuccessfully: 'Uspešno vraćeno.',
|
||||
restoring: 'Vraćanje...',
|
||||
|
||||
@@ -405,6 +405,7 @@ export const ruTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: 'Опубликовать изменения',
|
||||
published: 'Опубликовано',
|
||||
publishing: 'Публикация',
|
||||
restoreAsDraft: 'Восстановить как черновик',
|
||||
restoreThisVersion: 'Восстановить эту версию',
|
||||
restoredSuccessfully: 'Восстановлен успешно.',
|
||||
restoring: 'Восстановление...',
|
||||
|
||||
@@ -403,6 +403,7 @@ export const skTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: 'Publikovať zmeny',
|
||||
published: 'Publikované',
|
||||
publishing: 'Publikovanie',
|
||||
restoreAsDraft: 'Obnoviť ako koncept',
|
||||
restoreThisVersion: 'Obnoviť túto verziu',
|
||||
restoredSuccessfully: 'Úspešne obnovené.',
|
||||
restoring: 'Obnovovanie...',
|
||||
|
||||
@@ -402,6 +402,7 @@ export const svTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: 'Publicera ändringar',
|
||||
published: 'Publicerad',
|
||||
publishing: 'Publicering',
|
||||
restoreAsDraft: 'Återställ som utkast',
|
||||
restoreThisVersion: 'Återställ den här versionen',
|
||||
restoredSuccessfully: 'Återställd framgångsrikt.',
|
||||
restoring: 'Återställer...',
|
||||
|
||||
@@ -394,6 +394,7 @@ export const thTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: 'เผยแพร่การแก้ไข',
|
||||
published: 'เผยแพร่แล้ว',
|
||||
publishing: 'การเผยแพร่',
|
||||
restoreAsDraft: 'เรียกคืนเป็นร่าง',
|
||||
restoreThisVersion: 'กู้คืนเวอร์ชันนี้',
|
||||
restoredSuccessfully: 'กู้คืนเวอร์ชันสำเร็จ',
|
||||
restoring: 'กำลังกู้คืน...',
|
||||
|
||||
@@ -404,6 +404,7 @@ export const trTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: 'Değişiklikleri yayınla',
|
||||
published: 'Yayınlandı',
|
||||
publishing: 'Yayınlama',
|
||||
restoreAsDraft: 'Taslak olarak geri yükle',
|
||||
restoreThisVersion: 'Bu sürüme geri döndür',
|
||||
restoredSuccessfully: 'Geri getirme başarılı.',
|
||||
restoring: 'Geri döndürülüyor...',
|
||||
|
||||
@@ -402,6 +402,7 @@ export const ukTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: 'Опублікувати зміни',
|
||||
published: 'Опубліковано',
|
||||
publishing: 'Публікація',
|
||||
restoreAsDraft: 'Відновити як чернетку',
|
||||
restoreThisVersion: 'Відновити цю версію',
|
||||
restoredSuccessfully: 'Відновлено успішно.',
|
||||
restoring: 'Відновлення...',
|
||||
|
||||
@@ -397,6 +397,7 @@ export const viTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: 'Xuất bản tài liệu',
|
||||
published: 'Đã xuất bản',
|
||||
publishing: 'Xuất bản',
|
||||
restoreAsDraft: 'Khôi phục như bản nháp',
|
||||
restoreThisVersion: 'Khôi phục về phiên bản này',
|
||||
restoredSuccessfully: 'Đã khôi phục thành công.',
|
||||
restoring: 'Đang khôi phục...',
|
||||
|
||||
@@ -387,6 +387,7 @@ export const zhTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: '发布修改',
|
||||
published: '已发布',
|
||||
publishing: '发布',
|
||||
restoreAsDraft: '恢复为草稿',
|
||||
restoreThisVersion: '恢复此版本',
|
||||
restoredSuccessfully: '恢复成功。',
|
||||
restoring: '恢复中...',
|
||||
|
||||
@@ -387,6 +387,7 @@ export const zhTwTranslations: DefaultTranslationsObject = {
|
||||
publishChanges: '發佈修改',
|
||||
published: '已發佈',
|
||||
publishing: '發布',
|
||||
restoreAsDraft: '恢復為草稿',
|
||||
restoreThisVersion: '回復此版本',
|
||||
restoredSuccessfully: '回復成功。',
|
||||
restoring: '回復中...',
|
||||
|
||||
@@ -323,7 +323,7 @@ describe('versions', () => {
|
||||
const versionID = await row2.locator('.cell-id').textContent()
|
||||
await page.goto(`${savedDocURL}/versions/${versionID}`)
|
||||
await page.waitForURL(new RegExp(`${savedDocURL}/versions/${versionID}`))
|
||||
await page.locator('.pill.restore-version').click()
|
||||
await page.locator('.restore-version__button').click()
|
||||
await page.locator('button:has-text("Confirm")').click()
|
||||
await page.waitForURL(new RegExp(savedDocURL))
|
||||
await expect(page.locator('#field-title')).toHaveValue('v1')
|
||||
@@ -559,8 +559,8 @@ describe('versions', () => {
|
||||
await payload.create({
|
||||
collection: autosaveCollectionSlug,
|
||||
data: {
|
||||
title: 'some title',
|
||||
description: 'some description',
|
||||
title: 'some title',
|
||||
},
|
||||
draft: true,
|
||||
})
|
||||
@@ -580,8 +580,8 @@ describe('versions', () => {
|
||||
const maxOneCollection = await payload.create({
|
||||
collection: draftWithMaxCollectionSlug,
|
||||
data: {
|
||||
title: 'initial title',
|
||||
description: 'some description',
|
||||
title: 'initial title',
|
||||
},
|
||||
draft: true,
|
||||
})
|
||||
|
||||
@@ -1323,14 +1323,14 @@ describe('Versions', () => {
|
||||
slug: globalSlug,
|
||||
})
|
||||
|
||||
expect(restore.title).toBeDefined()
|
||||
expect(restore.version.title).toBeDefined()
|
||||
|
||||
const restoredGlobal = await payload.findGlobal({
|
||||
slug: globalSlug,
|
||||
draft: true,
|
||||
})
|
||||
|
||||
expect(restoredGlobal.title).toBe(restore.title)
|
||||
expect(restoredGlobal.title).toBe(restore.version.title.en)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1537,7 +1537,7 @@ describe('Versions', () => {
|
||||
},
|
||||
})
|
||||
.then((res) => res.json())
|
||||
expect(data.AutosaveGlobal.title).toStrictEqual(globalGraphQLOriginalTitle)
|
||||
expect(data.AutosaveGlobal).toEqual({ title: globalGraphQLOriginalTitle })
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user