fix: disable save button when the user has no write permission#1161
Closed
kptdobe wants to merge 1 commit into
Closed
fix: disable save button when the user has no write permission#1161kptdobe wants to merge 1 commit into
kptdobe wants to merge 1 commit into
Conversation
The lock icon already reflected read-only state via the is-read-only
class, but the Save action button ignored `_readOnly` entirely - only
`disabledText` gated it. A user with read-only config access could still
click Save (and would only find out it failed after the request).
Disable the save button (with a tooltip) when read-only, and guard
handleAction('save') itself in case the disabled state is bypassed.
|
Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch.
Commits
|
3 tasks
Contributor
Author
|
Branch renamed to comply with this repo's CLAUDE.md branch-naming rule (max 8 lowercase alphanumeric chars) - GitHub closed this PR as a side effect. Continued as #1162. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
is-read-onlyclass, driven by_readOnlyin da-title.js) already reflected read-only state correctly, but the Save action button'sdisabledbinding only checkedthis.disabledText- it ignored_readOnlyentirely.renderActions()now disables thesaveaction (with a tooltip) when_readOnlyis true.handleAction('save')also bails early as a guard against a stale/bypassed disabled state.Test plan
npx eslint blocks/edit/da-title/da-title.js test/unit/blocks/edit/da-title/da-title.test.jsnpx wtr "./test/unit/blocks/edit/da-title/da-title.test.js" --node-resolve— 50 passingdisabledreflects permissions inrenderActions, andhandleAction('save')is a no-op (no fetch) when read-only