fix(richtext-slate): link and upload extra field drawers did not render fields if collection has unrelated access control set (#10583)
Fixes https://github.com/payloadcms/payload/issues/9695
This commit is contained in:
@@ -69,7 +69,7 @@ export const LinkButton: React.FC<{
|
|||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const editor = useSlate()
|
const editor = useSlate()
|
||||||
const { getFormState } = useServerFunctions()
|
const { getFormState } = useServerFunctions()
|
||||||
const { collectionSlug, docPermissions, getDocPreferences, globalSlug } = useDocumentInfo()
|
const { collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()
|
||||||
|
|
||||||
const { closeModal, openModal } = useModal()
|
const { closeModal, openModal } = useModal()
|
||||||
const drawerSlug = useDrawerSlug('rich-text-link')
|
const drawerSlug = useDrawerSlug('rich-text-link')
|
||||||
@@ -98,7 +98,9 @@ export const LinkButton: React.FC<{
|
|||||||
const { state } = await getFormState({
|
const { state } = await getFormState({
|
||||||
collectionSlug,
|
collectionSlug,
|
||||||
data,
|
data,
|
||||||
docPermissions,
|
docPermissions: {
|
||||||
|
fields: true,
|
||||||
|
},
|
||||||
docPreferences: await getDocPreferences(),
|
docPreferences: await getDocPreferences(),
|
||||||
globalSlug,
|
globalSlug,
|
||||||
operation: 'update',
|
operation: 'update',
|
||||||
|
|||||||
@@ -101,7 +101,9 @@ export const LinkElement = () => {
|
|||||||
const { state } = await getFormState({
|
const { state } = await getFormState({
|
||||||
collectionSlug,
|
collectionSlug,
|
||||||
data,
|
data,
|
||||||
docPermissions,
|
docPermissions: {
|
||||||
|
fields: true,
|
||||||
|
},
|
||||||
docPreferences: await getDocPreferences(),
|
docPreferences: await getDocPreferences(),
|
||||||
globalSlug,
|
globalSlug,
|
||||||
operation: 'update',
|
operation: 'update',
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export const LinkDrawer: React.FC<Props> = ({
|
|||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const fieldMapPath = `${schemaPath}.${linkFieldsSchemaPath}`
|
const fieldMapPath = `${schemaPath}.${linkFieldsSchemaPath}`
|
||||||
|
|
||||||
const { id, collectionSlug, docPermissions, getDocPreferences, globalSlug } = useDocumentInfo()
|
const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()
|
||||||
|
|
||||||
const { getFormState } = useServerFunctions()
|
const { getFormState } = useServerFunctions()
|
||||||
|
|
||||||
@@ -42,7 +42,9 @@ export const LinkDrawer: React.FC<Props> = ({
|
|||||||
const { state } = await getFormState({
|
const { state } = await getFormState({
|
||||||
id,
|
id,
|
||||||
collectionSlug,
|
collectionSlug,
|
||||||
docPermissions,
|
docPermissions: {
|
||||||
|
fields: true,
|
||||||
|
},
|
||||||
docPreferences: await getDocPreferences(),
|
docPreferences: await getDocPreferences(),
|
||||||
formState: prevFormState,
|
formState: prevFormState,
|
||||||
globalSlug,
|
globalSlug,
|
||||||
@@ -53,7 +55,7 @@ export const LinkDrawer: React.FC<Props> = ({
|
|||||||
return state
|
return state
|
||||||
},
|
},
|
||||||
|
|
||||||
[getFormState, id, collectionSlug, getDocPreferences, docPermissions, globalSlug, fieldMapPath],
|
[getFormState, id, collectionSlug, getDocPreferences, globalSlug, fieldMapPath],
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -72,7 +74,7 @@ export const LinkDrawer: React.FC<Props> = ({
|
|||||||
parentIndexPath=""
|
parentIndexPath=""
|
||||||
parentPath={''}
|
parentPath={''}
|
||||||
parentSchemaPath=""
|
parentSchemaPath=""
|
||||||
permissions={docPermissions.fields}
|
permissions={true}
|
||||||
readOnly={false}
|
readOnly={false}
|
||||||
/>
|
/>
|
||||||
<LinkSubmit />
|
<LinkSubmit />
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export const UploadDrawer: React.FC<{
|
|||||||
const { i18n, t } = useTranslation()
|
const { i18n, t } = useTranslation()
|
||||||
const { code: locale } = useLocale()
|
const { code: locale } = useLocale()
|
||||||
const { closeModal } = useModal()
|
const { closeModal } = useModal()
|
||||||
const { id, collectionSlug, docPermissions, getDocPreferences, globalSlug } = useDocumentInfo()
|
const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()
|
||||||
|
|
||||||
const { getFormState } = useServerFunctions()
|
const { getFormState } = useServerFunctions()
|
||||||
|
|
||||||
@@ -75,7 +75,9 @@ export const UploadDrawer: React.FC<{
|
|||||||
id,
|
id,
|
||||||
collectionSlug,
|
collectionSlug,
|
||||||
data,
|
data,
|
||||||
docPermissions,
|
docPermissions: {
|
||||||
|
fields: true,
|
||||||
|
},
|
||||||
docPreferences: await getDocPreferences(),
|
docPreferences: await getDocPreferences(),
|
||||||
globalSlug,
|
globalSlug,
|
||||||
operation: 'update',
|
operation: 'update',
|
||||||
@@ -99,7 +101,6 @@ export const UploadDrawer: React.FC<{
|
|||||||
getFormState,
|
getFormState,
|
||||||
globalSlug,
|
globalSlug,
|
||||||
getDocPreferences,
|
getDocPreferences,
|
||||||
docPermissions,
|
|
||||||
])
|
])
|
||||||
|
|
||||||
const onChange: FormProps['onChange'][0] = useCallback(
|
const onChange: FormProps['onChange'][0] = useCallback(
|
||||||
@@ -107,7 +108,9 @@ export const UploadDrawer: React.FC<{
|
|||||||
const { state } = await getFormState({
|
const { state } = await getFormState({
|
||||||
id,
|
id,
|
||||||
collectionSlug,
|
collectionSlug,
|
||||||
docPermissions,
|
docPermissions: {
|
||||||
|
fields: true,
|
||||||
|
},
|
||||||
docPreferences: await getDocPreferences(),
|
docPreferences: await getDocPreferences(),
|
||||||
formState: prevFormState,
|
formState: prevFormState,
|
||||||
globalSlug,
|
globalSlug,
|
||||||
@@ -122,7 +125,6 @@ export const UploadDrawer: React.FC<{
|
|||||||
getFormState,
|
getFormState,
|
||||||
id,
|
id,
|
||||||
collectionSlug,
|
collectionSlug,
|
||||||
docPermissions,
|
|
||||||
getDocPreferences,
|
getDocPreferences,
|
||||||
globalSlug,
|
globalSlug,
|
||||||
schemaPath,
|
schemaPath,
|
||||||
@@ -150,7 +152,7 @@ export const UploadDrawer: React.FC<{
|
|||||||
parentIndexPath=""
|
parentIndexPath=""
|
||||||
parentPath=""
|
parentPath=""
|
||||||
parentSchemaPath=""
|
parentSchemaPath=""
|
||||||
permissions={docPermissions.fields}
|
permissions={true}
|
||||||
readOnly={false}
|
readOnly={false}
|
||||||
/>
|
/>
|
||||||
<FormSubmit>{t('fields:saveChanges')}</FormSubmit>
|
<FormSubmit>{t('fields:saveChanges')}</FormSubmit>
|
||||||
|
|||||||
Reference in New Issue
Block a user