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(core): disable scheduledPublishing and tasks if /features returns error #7517

Open
wants to merge 2 commits into
base: next
Choose a base branch
from

Conversation

pedrobonamin
Copy link
Contributor

Description

Some users have reported that they see the upsell ui even though the feature is enabled for the project.
That is due to the features api returning an error if the user doesn't have the right permissions to query it.

This PR adds the same check for scheduledPublishing and tasks plugins.
In comments we are currently doing that check here https://github.com/sanity-io/sanity/blob/edx-1599/packages/sanity/src/core/comments/hooks/useResolveCommentsEnabled.ts#L42-L43

What to review

Are this changes ok?

Testing

New tests have been introduced to guard this behavior.

Notes for release

Disable schedule publishing and tasks plugin if user doesn't have the right access.

Copy link

vercel bot commented Sep 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
page-building-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 17, 2024 3:32pm
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 17, 2024 3:32pm
test-compiled-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 17, 2024 3:32pm
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 17, 2024 3:32pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 17, 2024 3:32pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Sep 17, 2024 3:32pm

@pedrobonamin pedrobonamin requested review from a team and rexxars and removed request for a team September 17, 2024 12:11
@pedrobonamin pedrobonamin changed the title fix(core): disable scheduledPublishing and tasks plugins if features returns error fix(core): disable scheduledPublishing and tasks plugins if /features returns error Sep 17, 2024
@pedrobonamin pedrobonamin changed the title fix(core): disable scheduledPublishing and tasks plugins if /features returns error fix(core): disable scheduledPublishing and tasks if /features returns error Sep 17, 2024
Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented Sep 17, 2024

Component Testing Report Updated Sep 17, 2024 3:36 PM (UTC)

✅ All Tests Passed -- expand for details
File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 47s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 8s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 31s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 37s 11 7 0
formBuilder/inputs/PortableText/copyPaste/CopyPasteFields.spec.tsx ✅ Passed (Inspect) 0s 0 12 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 18s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 10s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 3m 0s 0 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 46s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 46s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 17s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 9s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 27s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 18s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 36s 12 0 0
formBuilder/tree-editing/TreeEditing.spec.tsx ✅ Passed (Inspect) 0s 0 3 0
formBuilder/tree-editing/TreeEditingNestedObjects.spec.tsx ✅ Passed (Inspect) 0s 0 3 0

<Container width={1} paddingTop={4}>
<Box paddingTop={4} paddingX={4}>
<ErrorCallout
description="You do not have permission to edit schedules."
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ℹ️ We don't have translations in scheduledPublishing
Instead of showing the same error that we show when the request fails we add an specific not enabled error.
**Current error **
Screenshot 2024-09-17 at 17 23 06

Updated error
Screenshot 2024-09-17 at 17 24 34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant