Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix add context view to rest request so that authors can view terms #245

Merged
merged 1 commit into from
Aug 10, 2023

Conversation

fabiankaegy
Copy link
Member

@fabiankaegy fabiankaegy commented Aug 9, 2023

Description of the Change

Whilst testing the PostTermList component on a site we found an issue where the block crashed for anyone with the Author user role. Traking it down, the issue is that authors are not able to access the edit context of rest API requests to the taxonomy endpoint. To fix it we explicitly set the context in the useAllTerms hook to view

How to test the Change

  1. Create a user with the "Author" role
  2. Create a new post as the Author
  3. Insert the "Hero" block bundled with the example plugin
  4. See that the block fails. Test again with this patch applied and see that it is ressolved

Changelog Entry

Fixed - Change context of rest query in useAllTerms hook to view to ensure users with the role Author can use the component.

Credits

Props @dborgesmj @RobertWise @fabiankaegy

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@github-actions
Copy link

github-actions bot commented Aug 9, 2023

Size Change: +15 B (0%)

Total Size: 53.5 kB

Filename Size Change
dist/index.js 53.5 kB +15 B (0%)

compressed-size-action

Copy link
Member

@Antonio-Laguna Antonio-Laguna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nice catch!

@fabiankaegy fabiankaegy merged commit 033705f into develop Aug 10, 2023
@fabiankaegy fabiankaegy deleted the fix/authors-not-able-to-view-terms branch August 10, 2023 06:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants