fix(plugin-seo): enforce readonly on the client (#9536)
### What? Plugin-seo fields were not set to disabled when a user did not have permissions. ### Why? The `readOnly` property was not being used. ### How? Uses the `readOnly` property to disable buttons and set inputs to readOnly.
This commit is contained in:
@@ -39,6 +39,7 @@ export const MetaDescriptionComponent: React.FC<MetaDescriptionProps> = (props)
|
|||||||
},
|
},
|
||||||
hasGenerateDescriptionFn,
|
hasGenerateDescriptionFn,
|
||||||
path,
|
path,
|
||||||
|
readOnly,
|
||||||
} = props
|
} = props
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -139,6 +140,7 @@ export const MetaDescriptionComponent: React.FC<MetaDescriptionProps> = (props)
|
|||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
—
|
—
|
||||||
<button
|
<button
|
||||||
|
disabled={readOnly}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
void regenerateDescription()
|
void regenerateDescription()
|
||||||
}}
|
}}
|
||||||
@@ -185,6 +187,7 @@ export const MetaDescriptionComponent: React.FC<MetaDescriptionProps> = (props)
|
|||||||
Error={errorMessage}
|
Error={errorMessage}
|
||||||
onChange={setValue}
|
onChange={setValue}
|
||||||
path={path}
|
path={path}
|
||||||
|
readOnly={readOnly}
|
||||||
required={required}
|
required={required}
|
||||||
showError={showError}
|
showError={showError}
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ export const MetaImageComponent: React.FC<MetaImageProps> = (props) => {
|
|||||||
field: { label, localized, relationTo, required },
|
field: { label, localized, relationTo, required },
|
||||||
hasGenerateImageFn,
|
hasGenerateImageFn,
|
||||||
path,
|
path,
|
||||||
|
readOnly,
|
||||||
} = props || {}
|
} = props || {}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -133,6 +134,7 @@ export const MetaImageComponent: React.FC<MetaImageProps> = (props) => {
|
|||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
—
|
—
|
||||||
<button
|
<button
|
||||||
|
disabled={readOnly}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
void regenerateImage()
|
void regenerateImage()
|
||||||
}}
|
}}
|
||||||
@@ -186,6 +188,7 @@ export const MetaImageComponent: React.FC<MetaImageProps> = (props) => {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
path={path}
|
path={path}
|
||||||
|
readOnly={readOnly}
|
||||||
relationTo={relationTo}
|
relationTo={relationTo}
|
||||||
required={required}
|
required={required}
|
||||||
serverURL={serverURL}
|
serverURL={serverURL}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ export const MetaTitleComponent: React.FC<MetaTitleProps> = (props) => {
|
|||||||
field: { label, maxLength: maxLengthFromProps, minLength: minLengthFromProps, required },
|
field: { label, maxLength: maxLengthFromProps, minLength: minLengthFromProps, required },
|
||||||
hasGenerateTitleFn,
|
hasGenerateTitleFn,
|
||||||
path,
|
path,
|
||||||
|
readOnly,
|
||||||
} = props || {}
|
} = props || {}
|
||||||
|
|
||||||
const { t } = useTranslation<PluginSEOTranslations, PluginSEOTranslationKeys>()
|
const { t } = useTranslation<PluginSEOTranslations, PluginSEOTranslationKeys>()
|
||||||
@@ -127,6 +128,7 @@ export const MetaTitleComponent: React.FC<MetaTitleProps> = (props) => {
|
|||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
—
|
—
|
||||||
<button
|
<button
|
||||||
|
disabled={readOnly}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
void regenerateTitle()
|
void regenerateTitle()
|
||||||
}}
|
}}
|
||||||
@@ -174,6 +176,7 @@ export const MetaTitleComponent: React.FC<MetaTitleProps> = (props) => {
|
|||||||
Error={errorMessage}
|
Error={errorMessage}
|
||||||
onChange={setValue}
|
onChange={setValue}
|
||||||
path={path}
|
path={path}
|
||||||
|
readOnly={readOnly}
|
||||||
required={required}
|
required={required}
|
||||||
showError={showError}
|
showError={showError}
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
Reference in New Issue
Block a user