feat: adds new experimental.localizeStatus option (#13207)
### What? Adds a new `experimental.localizeStatus` config option, set to `false` by default. When `true`, the admin panel will display the document status based on the *current locale* instead of the _latest_ overall status. Also updates the edit view to only show a `changed` status when `autosave` is enabled. ### Why? Showing the status for the current locale is more accurate and useful in multi-locale setups. This update will become default behavior, able to be opted in by setting `experimental.localizeStatus: true` in the Payload config. This option will become depreciated in V4. ### How? When `localizeStatus` is `true`, we store the localized status in a new `localeStatus` field group within version data. The admin panel then reads from this field to display the correct status for the current locale. --------- Co-authored-by: Jarrod Flesch <jarrodmflesch@gmail.com>
This commit is contained in:
@@ -673,6 +673,33 @@ describe('Localization', () => {
|
||||
await changeLocale(page, defaultLocale)
|
||||
await expect(page.locator('#field-title')).toBeEmpty()
|
||||
})
|
||||
|
||||
test('should show localized status in collection list', async () => {
|
||||
await page.goto(urlPostsWithDrafts.create)
|
||||
const engTitle = 'Eng published'
|
||||
const spanTitle = 'Spanish draft'
|
||||
|
||||
await changeLocale(page, defaultLocale)
|
||||
await fillValues({ title: engTitle })
|
||||
await saveDocAndAssert(page)
|
||||
|
||||
await changeLocale(page, spanishLocale)
|
||||
await fillValues({ title: spanTitle })
|
||||
await saveDocAndAssert(page, '#action-save-draft')
|
||||
|
||||
await page.goto(urlPostsWithDrafts.list)
|
||||
|
||||
const columns = page.getByRole('button', { name: 'Columns' })
|
||||
await columns.click()
|
||||
await page.locator('#_status').click()
|
||||
|
||||
await expect(page.locator('.row-1 .cell-title')).toContainText(spanTitle)
|
||||
await expect(page.locator('.row-1 .cell-_status')).toContainText('Draft')
|
||||
|
||||
await changeLocale(page, defaultLocale)
|
||||
await expect(page.locator('.row-1 .cell-title')).toContainText(engTitle)
|
||||
await expect(page.locator('.row-1 .cell-_status')).toContainText('Published')
|
||||
})
|
||||
})
|
||||
|
||||
test('should not show publish specific locale button when no localized fields exist', async () => {
|
||||
|
||||
Reference in New Issue
Block a user