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.

6 participants