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: login button does not render #19685

Merged
merged 2 commits into from
Apr 13, 2022

Conversation

villebro
Copy link
Member

@villebro villebro commented Apr 13, 2022

SUMMARY

PR #19051 caused a regression causing the welcome page to fail to render for anonymous users. This adds a new type UndefinedUser (an empty object), adds type guards for both User and UserWithPermissionsAndRoles and updates related functions based on the following comment:

// in redux, when there is no user, the user is actually set to an empty object,
// so we need to handle missing roles as well as a missing user.s

In addition, tests are added to ensure isAdminUser works for all relevant user types.

AFTER

Now the welcome page renders correctly:
image

BEFORE

When going to the main page without being logged in, the following appears:
image

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@villebro villebro force-pushed the villebro/isUserAdmin branch 2 times, most recently from c26d980 to b87d364 Compare April 13, 2022 08:15
@codecov
Copy link

codecov bot commented Apr 13, 2022

Codecov Report

Merging #19685 (b6d5b04) into master (6e8e29c) will decrease coverage by 0.00%.
The diff coverage is 88.88%.

❗ Current head b6d5b04 differs from pull request most recent head 0a24c83. Consider uploading reports for the commit 0a24c83 to get more accurate results

@@            Coverage Diff             @@
##           master   #19685      +/-   ##
==========================================
- Coverage   66.50%   66.50%   -0.01%     
==========================================
  Files        1683     1684       +1     
  Lines       64520    64525       +5     
  Branches     6607     6612       +5     
==========================================
+ Hits        42910    42913       +3     
  Misses      19916    19916              
- Partials     1694     1696       +2     
Flag Coverage Δ
javascript 51.12% <88.88%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...rset-frontend/src/dashboard/util/findPermission.ts 92.30% <85.71%> (-7.70%) ⬇️
superset-frontend/src/types/bootstrapTypes.ts 100.00% <100.00%> (ø)
...perset-frontend/src/views/components/MenuRight.tsx 66.66% <0.00%> (-1.15%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6e8e29c...0a24c83. Read the comment docs.

Copy link
Member

@kgabryje kgabryje left a comment

Choose a reason for hiding this comment

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

Tested, LGTM. Thanks for the fix!

@villebro villebro merged commit 2ba484f into apache:master Apr 13, 2022
@villebro villebro deleted the villebro/isUserAdmin branch April 13, 2022 13:04
sadpandajoe pushed a commit to preset-io/superset that referenced this pull request Apr 13, 2022
* fix: login button does not render

* add type guard

(cherry picked from commit 2ba484f)
@sadpandajoe
Copy link
Member

🏷️ preset:2022.15

michael-s-molina pushed a commit that referenced this pull request May 27, 2022
* fix: login button does not render

* add type guard
philipher29 pushed a commit to ValtechMobility/superset that referenced this pull request Jun 9, 2022
* fix: login button does not render

* add type guard
@mistercrunch mistercrunch added 🍒 1.5.1 🍒 1.5.2 🍒 1.5.3 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.0.0 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels preset:2022.15 preset-io size/L 🍒 1.5.1 🍒 1.5.2 🍒 1.5.3 🚢 2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants