[B] Fix crash when trying to access roles with an anonymous user #3827
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 fixes a crash when trying to access records in the local env as an anonymous user. The crash happened when calling
roles
on anAnonymousUser
class, a method the class doesn't have. Adding a mock for it fixes the issue.It's unclear to me why this isn't happening in edge, or why the issue was only noticed recently. The relevant files haven't been changed in several months. A possible culprit is this commit: 9a94217#diff-25f7b21a047b52c4068e2ef9030192afb4ad52f16d63c3acd7f949a1c6eb42d1R7
However, reverting my branch to before that commit breaks my local env for a variety of different reasons, making it difficult to test.