fix: utilizes override access false (#9550)

### What?
overrideAccess was missing on local operations inside the server
function for copy locale.

### How?
Adds overrideAccess: false
This commit is contained in:
Jarrod Flesch
2024-11-26 20:29:16 -05:00
committed by GitHub
parent 21db058e2e
commit 2248be4a2e
2 changed files with 7 additions and 0 deletions

View File

@@ -190,6 +190,7 @@ export const copyDataFromLocale = async (args: CopyDataFromLocaleArgs) => {
? payload.findGlobal({ ? payload.findGlobal({
slug: globalSlug, slug: globalSlug,
locale: fromLocale, locale: fromLocale,
overrideAccess: false,
user, user,
// `select` would allow us to select only the fields we need in the future // `select` would allow us to select only the fields we need in the future
}) })
@@ -197,6 +198,7 @@ export const copyDataFromLocale = async (args: CopyDataFromLocaleArgs) => {
id: docID, id: docID,
collection: collectionSlug, collection: collectionSlug,
locale: fromLocale, locale: fromLocale,
overrideAccess: false,
user, user,
// `select` would allow us to select only the fields we need in the future // `select` would allow us to select only the fields we need in the future
}), }),
@@ -204,6 +206,7 @@ export const copyDataFromLocale = async (args: CopyDataFromLocaleArgs) => {
? payload.findGlobal({ ? payload.findGlobal({
slug: globalSlug, slug: globalSlug,
locale: toLocale, locale: toLocale,
overrideAccess: false,
user, user,
// `select` would allow us to select only the fields we need in the future // `select` would allow us to select only the fields we need in the future
}) })
@@ -211,6 +214,7 @@ export const copyDataFromLocale = async (args: CopyDataFromLocaleArgs) => {
id: docID, id: docID,
collection: collectionSlug, collection: collectionSlug,
locale: toLocale, locale: toLocale,
overrideAccess: false,
user, user,
// `select` would allow us to select only the fields we need in the future // `select` would allow us to select only the fields we need in the future
}), }),
@@ -231,6 +235,7 @@ export const copyDataFromLocale = async (args: CopyDataFromLocaleArgs) => {
? fromLocaleData.value ? fromLocaleData.value
: mergeData(fromLocaleData.value, toLocaleData.value, globals[globalSlug].config.fields), : mergeData(fromLocaleData.value, toLocaleData.value, globals[globalSlug].config.fields),
locale: toLocale, locale: toLocale,
overrideAccess: false,
user, user,
}) })
: await payload.update({ : await payload.update({
@@ -244,6 +249,7 @@ export const copyDataFromLocale = async (args: CopyDataFromLocaleArgs) => {
collections[collectionSlug].config.fields, collections[collectionSlug].config.fields,
), ),
locale: toLocale, locale: toLocale,
overrideAccess: false,
user, user,
}) })

View File

@@ -261,6 +261,7 @@ describe('Localization', () => {
await createAndSaveDoc(page, url, { description, title }) await createAndSaveDoc(page, url, { description, title })
await openCopyToLocaleDrawer(page) await openCopyToLocaleDrawer(page)
await expect(page.locator('.copy-locale-data__content')).toBeVisible() await expect(page.locator('.copy-locale-data__content')).toBeVisible()
await page.locator('.drawer-close-button').click()
}) })
test('should copy data to correct locale', async () => { test('should copy data to correct locale', async () => {