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

feat(sanity): request access flow #7248

Merged
merged 28 commits into from
Aug 20, 2024
Merged

feat(sanity): request access flow #7248

merged 28 commits into from
Aug 20, 2024

Conversation

drewlyton
Copy link
Contributor

@drewlyton drewlyton commented Jul 25, 2024

Description

This PR introduces a new "Request Access" flow for non-authorized users trying to access a studio.
SCR-20240725-kkiv

Link to project/issue in Linear

What to review

This PR redirects users to a new RequestAccessScreen component from the AuthBoundary if the user is not authorized and they are not using the sanity authentication provider. More information about this decision can be found here.

On mount, the RequestAccessScreen component makes a call to the /access/requests/me endpoint and checks if the user currently has a pending request for this project. If the user does, we show them a "request pending" state.
SCR-20240725-kmrq

If they do not, we show them the form to create a new access request with an optional note:
SCR-20240725-kkiv

Once submitted, the user will see the "request pending" state and a toast message saying their request was submitted.

In the case where they have submitted too many requests in a certain period as defined by the backend, we show them a warning message after submitting.
SCR-20240725-knjz

In the case where there is an error fetching from the Access API, we fallback to the current NotAuthenticatedScreen.

Testing

No automated tests were added for this screen, but testing can be done by running the code against the development studio while logged into a non-authorized account.

Notes for release

See section above for a description of the new flow. I do not believe any new documentation needs to be written for this feature.

Copy link

vercel bot commented Jul 25, 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 Aug 20, 2024 2:08pm
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 20, 2024 2:08pm
test-compiled-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 20, 2024 2:08pm
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 20, 2024 2:08pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 20, 2024 2:08pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Aug 20, 2024 2:08pm

@drewlyton drewlyton changed the title Feat/request access gro 2298 feat(sanity): request access flow Jul 25, 2024
Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented Jul 25, 2024

Component Testing Report Updated Aug 20, 2024 2:12 PM (UTC)

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

@drewlyton drewlyton force-pushed the feat/request-access-gro-2298 branch from 9657fb4 to 7429aac Compare July 25, 2024 16:11

import {NotAuthenticatedScreen} from './NotAuthenticatedScreen'

interface AccessRequest {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if this is where this type should go? I believe this will be the only screen to use it but would prefer to follow standard practice for codebase if applicable

Copy link
Member

Choose a reason for hiding this comment

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

I think this seems sensible

}
})
.catch((err) => {
console.error(err)
Copy link
Contributor Author

@drewlyton drewlyton Jul 25, 2024

Choose a reason for hiding this comment

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

Not sure if it's standard practice to send silent/handled errors to the console for the studio. In NotAuthenticatedScreen it seemed like we just threw an error and crashed the studio if we saw one

@svirs svirs added this pull request to the merge queue Aug 20, 2024
Merged via the queue into next with commit 5ab35a5 Aug 20, 2024
42 checks passed
@svirs svirs deleted the feat/request-access-gro-2298 branch August 20, 2024 14:13
cngonzalez pushed a commit that referenced this pull request Aug 20, 2024
* feat: create request access screen

* refactor: readablity edits

* feat: add submitting states and toasts

* refactor: merge useEffect hook and update some comments

* chore: add comment explaining the client access strategy

* feat: update pending state copy and style

* fix: remove eslint disable from AuthBoundary

* revert: not authenticated screen text

* fix: typo in comment

* fix: bug in date check

* fix: authboundary provider error, client config bug, and enter key to submit

* fix: update text copy for NotAuthenticated

* fix: remove toast for success message

* fix: couple small ui tweaks

* fix: revert muted text color

* feat: add requestURL to project request payload

* fix: copy changes, check for declined invite, error handling

* fix: use date-fns, change copy if resubmitting a request

* use ui-components for button/dialog

* pnpm-lock

* maxLength for text input for note

* feat: limit note length, show char count

* hide submit button when declined

* remove dialog padding

* use error responses for submission errors

* pnpm-lock.yaml

* pnpm-lock.yaml

* optional chaining on err response object

Co-authored-by: Rico Kahler <[email protected]>

---------

Co-authored-by: svirs <[email protected]>
Co-authored-by: Rico Kahler <[email protected]>
jordanl17 pushed a commit that referenced this pull request Aug 29, 2024
* feat: create request access screen

* refactor: readablity edits

* feat: add submitting states and toasts

* refactor: merge useEffect hook and update some comments

* chore: add comment explaining the client access strategy

* feat: update pending state copy and style

* fix: remove eslint disable from AuthBoundary

* revert: not authenticated screen text

* fix: typo in comment

* fix: bug in date check

* fix: authboundary provider error, client config bug, and enter key to submit

* fix: update text copy for NotAuthenticated

* fix: remove toast for success message

* fix: couple small ui tweaks

* fix: revert muted text color

* feat: add requestURL to project request payload

* fix: copy changes, check for declined invite, error handling

* fix: use date-fns, change copy if resubmitting a request

* use ui-components for button/dialog

* pnpm-lock

* maxLength for text input for note

* feat: limit note length, show char count

* hide submit button when declined

* remove dialog padding

* use error responses for submission errors

* pnpm-lock.yaml

* pnpm-lock.yaml

* optional chaining on err response object

Co-authored-by: Rico Kahler <[email protected]>

---------

Co-authored-by: svirs <[email protected]>
Co-authored-by: Rico Kahler <[email protected]>
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.

4 participants