Support User: User data defaults to false
instead of undefined
#6854
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a fix for support user, currently broken.
This change sets the user data to
false
when the session is a support user session, rather than leaving it asundefined
which caused an error in the community translator jumpstart.This change also adds a condition to exit the community translator jumpstart if no user is found, preventing the exception which could halt the boot process.
Support user starts Calypso with no user, which currently causes the
communityTranslatorJumpstart
function to fail with an exceptionCannot read property 'localeSlug' of undefined
- see #3843.Any code that used this function (usually indirectly via
translate
) was breaking on the exception.PR #6645 introduced a notices middleware which indirectly called the translator jumpstart somewhere in the Calypso boot process, before the support user was loaded. The localeSlug error thus broke the Calypso boot process.
Closes #3843
Test live: https://calypso.live/?branch=fix/support-user/localeslug-error
cc @deBhal @rralian @yoavf @dllh