fix(richtext-lexical): link drawer has no fields if parent document create access control is false (#10954)

Previously, the lexical link drawer did not display any fields if the
`create` permission was false, even though the `update` permission was
true.

The issue was a faulty permission check in `RenderFields` that did not
check the top-level permission operation keys for truthiness. It only
checked if the `permissions` variable itself was `true`, or if the
sub-fields had `create` / `update` permissions set to `true`.
This commit is contained in:
Alessio Gravili
2025-02-03 12:02:40 -07:00
committed by GitHub
parent 6353cf8bbe
commit 136c90c725
8 changed files with 133 additions and 9 deletions

View File

@@ -495,10 +495,12 @@ export const seed = async (_payload: Payload) => {
data: {
text: 'text',
},
depth: 0,
})
await _payload.create({
collection: 'LexicalInBlock',
depth: 0,
data: {
content: {
root: {
@@ -537,24 +539,36 @@ export const seed = async (_payload: Payload) => {
},
})
await _payload.create({
collection: 'lexical-access-control',
data: {
richText: textToLexicalJSON({ text: 'text' }),
title: 'title',
},
depth: 0,
})
await Promise.all([
_payload.create({
collection: customIDSlug,
data: {
id: nonStandardID,
},
depth: 0,
}),
_payload.create({
collection: customTabIDSlug,
data: {
id: customTabID,
},
depth: 0,
}),
_payload.create({
collection: customRowIDSlug,
data: {
id: customRowID,
},
depth: 0,
}),
])
}