[Block Library - Site Title, Site Tagline] - Readonly view when user has no the right permissions#32817
Merged
ntsekouras merged 3 commits intotrunkfrom Jun 21, 2021
Merged
Conversation
…has no the right permissions
|
Size Change: +250 B (0%) Total Size: 1.04 MB
ℹ️ View Unchanged
|
ockham
reviewed
Jun 21, 2021
Comment on lines
+42
to
+54
| <RichText | ||
| allowedFormats={ [] } | ||
| onChange={ setSiteTagline } | ||
| aria-label={ __( 'Site tagline text' ) } | ||
| placeholder={ __( 'Write site tagline…' ) } | ||
| tagName="p" | ||
| value={ siteTagline } | ||
| { ...blockProps } | ||
| /> | ||
| ) : ( | ||
| <p { ...blockProps }> | ||
| { readOnlySiteTagLine || __( 'Site Tagline placeholder' ) } | ||
| </p> |
Contributor
There was a problem hiding this comment.
Makes me wonder if in the long term, we should add readOnly bool props to some of our components 🤔
Contributor
Author
There was a problem hiding this comment.
Can you expand a bit on this with a 'dummy' example?
youknowriad
pushed a commit
that referenced
this pull request
Jun 21, 2021
…has no the right permissions (#32817) * [Block Library - Site Title, Site Tagline] - Readonly view when user has no the right permissions * fix multi-entity-save tests * Fallback value during init of RichText until title is loaded
youknowriad
pushed a commit
that referenced
this pull request
Jun 21, 2021
…has no the right permissions (#32817) * [Block Library - Site Title, Site Tagline] - Readonly view when user has no the right permissions * fix multi-entity-save tests * Fallback value during init of RichText until title is loaded
6 tasks
7 tasks
6 tasks
6 tasks
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.
Description
Part of: #26573
Currently when a user with no right permissions to edit
Site TitleandSite Taglinehas a broken experience for these blocks due to the permissions check happening at the REST API.This PR fixes that by checking the rights and adding a
readonlyview for these blocks, for those users.In addition I have added a check to both blocks to bail early and print nothing in the front-end, if the respective values are
empty.Testing instructions
adminuser insert these two blocks and observe that everything works as expected.author,editor, etc...), insert the blocks and observe that arereadonly, but can be moved and their block attributes can be changed (ex.text align).empty, where theadmincan still edit, but the other users see aplaceholder text, so they can still apply changes for when/if a value is set.Checklist:
*.native.jsfiles for terms that need renaming or removal).