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

change: [M3-7740] - Use "default" for non-parent/proxy/child user_type instead of null #10176

Merged
merged 7 commits into from
Feb 13, 2024

Conversation

mjac0bs
Copy link
Contributor

@mjac0bs mjac0bs commented Feb 12, 2024

Description πŸ“

API has changed the user_type for regular (non parent/child/proxy) users to return "default" rather than null.

Since we've been basing our mocks off of a null user_type, this API update required some refactoring in the UI, as well as updates to tests (unit and Cypress).

Changes πŸ”„

  • Updates user_type in types.ts apiv4 files to include "default" instead of null a valid value
  • Updates factories
  • Updates components, unit test, and Cypress tests that explicitly referred to user_type: null or used nullish coalescing to display UI components to a "regular" (non-parent/proxy/child) user.
    • This includes fixing an issue that was causing the user menu to always display the company name above the username for any user type, which should not be visible to regular users.

Preview πŸ“·

Before After
Screenshot 2024-02-12 at 7 47 18 AM Screenshot 2024-02-12 at 7 48 44 AM

How to test πŸ§ͺ

Prerequisites

(How to setup test environment)

  • Check out this PR and yarn up.
  • Make sure the parent/child feature flag is on and turn the mocks on.

Reproduction steps

(How to reproduce the issue, if applicable)

  • Check out develop and yarn up.
  • Make sure the parent/child feature flag is on and turn the mocks on.
  • Change user_type in serverHandlers.ts to null.
  • In desktop view, go to http://localhost:3000 and look at the top menu in the top right of the screen. Observe that the Mock Company is displayed below the username.

Verification steps

(How to verify changes)

  • On this PR branch, change user_type in serverHandlers.ts to default.
  • Confirm unit tests and e2es pass.
  • We should be able to rely on test coverage for the following, but to confirm manually:

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

@mjac0bs mjac0bs self-assigned this Feb 12, 2024
@@ -40,7 +36,6 @@ describe('Account login history', () => {
restricted: false,
});

mockGetAccount(mockAccount).as('getAccount');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unrelated to the user_type change: we didn't actually need to mock GET account in these login history specs, so it's been removed.

Comment on lines +74 to +78
const companyName =
(hasParentChildAccountAccess &&
profile?.user_type !== 'default' &&
account?.company) ??
'';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was the fix for the user menu that would have displayed the company name for regular users, without explicitly checking now that the user_type isn't default.

@mjac0bs mjac0bs marked this pull request as ready for review February 12, 2024 18:23
@mjac0bs mjac0bs requested review from a team as code owners February 12, 2024 18:23
@mjac0bs mjac0bs requested review from cliu-akamai, dwiley-akamai and hana-linode and removed request for a team February 12, 2024 18:23
Copy link
Contributor

@jaalah-akamai jaalah-akamai left a comment

Choose a reason for hiding this comment

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

Looking good πŸ‘

@jaalah-akamai jaalah-akamai added the Add'tl Approval Needed Waiting on another approval! label Feb 12, 2024
@mjac0bs mjac0bs added Approved Multiple approvals and ready to merge! and removed Add'tl Approval Needed Waiting on another approval! Ready for Review labels Feb 13, 2024
@mjac0bs mjac0bs merged commit 66fe7fa into linode:develop Feb 13, 2024
18 checks passed
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! Parent / Child Account
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants