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

refactor: [M3-7786] - Convert isRestrictedGlobalGrantType to Hook #10203

Merged
merged 4 commits into from
Feb 20, 2024

Conversation

jaalah-akamai
Copy link
Contributor

@jaalah-akamai jaalah-akamai commented Feb 16, 2024

Description πŸ“

By converting isRestrictedGlobalGrantType to a hook we can avoid having to pass in grants and profile and clean up the API.

Changes πŸ”„

  • Removed isRestrictedGlobalGrantType util
  • Added useRestrictedGlobalGrantCheck hook
    • Added test coverage

Target release date πŸ—“οΈ

03/04/2024

Preview πŸ“·

Before

const isRestricted = isRestrictedGlobalGrantType({
    globalGrantType: 'add_nodebalancers',
    grants,
    profile,
});

After

const isRestricted = useRestrictedGlobalGrantCheck({
    globalGrantType: 'add_nodebalancers',
});

How to test πŸ§ͺ

There should be no functional changes, but see testing instructions: #10095

As an Author I have considered πŸ€”

Check all that apply

  • πŸ‘€ Doing a self review
  • ❔ Our contribution guidelines
  • 🀏 Splitting feature into small PRs
  • βž• Adding a changeset
  • πŸ§ͺ Providing/Improving test coverage
  • πŸ” Removing all sensitive information from the code and PR description
  • 🚩 Using a feature flag to protect the release
  • πŸ‘£ Providing comprehensive reproduction steps
  • πŸ“‘ Providing or updating our documentation
  • πŸ•› Scheduling a pair reviewing session
  • πŸ“± Providing mobile support
  • β™Ώ Providing accessibility support

@jaalah-akamai jaalah-akamai self-assigned this Feb 16, 2024
@jaalah-akamai jaalah-akamai requested a review from a team as a code owner February 16, 2024 20:52
@jaalah-akamai jaalah-akamai requested review from jdamore-linode and carrillo-erik and removed request for a team February 16, 2024 20:52
@jaalah-akamai jaalah-akamai added the Restricted User Access Improve UX surrounding restricted access to features label Feb 16, 2024
Copy link
Contributor

@mjac0bs mjac0bs left a comment

Choose a reason for hiding this comment

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

Went through #10095's test steps and confirmed the disabled aspects for a restricted user's account were as expected.

Thanks for the test coverage - those initial cases at least look good for now.

Edit: pending typecheck and unit tests are no longer failing in CI - forgot about those. πŸ‘€

Screenshot 2024-02-16 at 2 59 55 PM
Screenshot 2024-02-16 at 2 59 47 PM

Co-authored-by: Banks Nussman <115251059+bnussman-akamai@users.noreply.github.com>
Copy link

Coverage Report: βœ…
Base Coverage: 81.24%
Current Coverage: 81.26%

Copy link
Contributor

@jdamore-linode jdamore-linode left a comment

Choose a reason for hiding this comment

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

Thanks for the hook tests! We don't have a ton of tests for hooks, so it's even more helpful to have these as extra examples for devs to refer to

@jaalah-akamai jaalah-akamai merged commit f5bd65f into linode:develop Feb 20, 2024
18 checks passed
@mjac0bs mjac0bs added Approved Multiple approvals and ready to merge! and removed Ready for Review labels Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved Multiple approvals and ready to merge! Restricted User Access Improve UX surrounding restricted access to features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants