aspedrosa opened a new pull request #15590:
URL: https://github.com/apache/superset/pull/15590


   Note: this fix won't be visible because since 1.2.0 there is a bug where 
anonymous users receive an Unexpected Error when viewing a dashboard, however, 
it will be fixed in #15585
   
   ### SUMMARY
   This problem had already been fixed in #8527, however, the value of 
`dashboard.userId` is now being converted into a string 
[here](https://github.com/apache/superset/blob/301b94f49abef8a2d8e680fcd1c636be6cd45fa4/superset-frontend/src/dashboard/actions/hydrate.js#L339),
 so in cases of an anonymous user, its value will be `"undefined"`.
   With this, the fav star component will render due to 
[this](https://github.com/apache/superset/blob/301b94f49abef8a2d8e680fcd1c636be6cd45fa4/superset-frontend/src/dashboard/components/Header/index.jsx#L407)
 condition.
   
   My changes:
   Since 
[hydrate.js](https://github.com/apache/superset/blob/301b94f49abef8a2d8e680fcd1c636be6cd45fa4/superset-frontend/src/dashboard/actions/hydrate.js#L339)
 says that `dashboard.userId` is legacy, I pass the value of `user.userId` as a 
prop to the header component, which is value is `undefined` when there is no 
user logged in.
   
   ### TESTING INSTRUCTIONS
   1. Add the permission mentioned in 
[this](https://github.com/apache/superset/issues/14912#issuecomment-876377800) 
comment to the public role OR set PUBLIC_ROLE_LIKE = "Gamma"
   2. Create a dashboard if don't have any
   3. Copy the URL for the dashboard 
   4. Logout or enter an anonymous browser session
   5. Enter in the dashboard's URL
   6. Check if the error message doesn't appear
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [x] Has associated issue: #14720
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] 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
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to