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
@@ -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