Skip to content

Commit

Permalink
Merge pull request #19818 from situchan/fix/18293-follow-up
Browse files Browse the repository at this point in the history
fix crash when open report for anonymous user
  • Loading branch information
marcochavezf authored May 30, 2023
2 parents a98f3bc + 54ca453 commit 00a771f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/libs/BootSplash/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ function hide() {

return document.fonts.ready.then(() => {
const splash = document.getElementById('splash');
splash.style.opacity = 0;
if (splash) splash.style.opacity = 0;

return resolveAfter(250).then(() => {
if (!splash || !splash.parentNode) return;
splash.parentNode.removeChild(splash);
});
});
Expand Down
5 changes: 5 additions & 0 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,11 @@ function isAllowedToComment(report) {
return true;
}

// If unauthenticated user opens public chat room using deeplink, they do not have policies available and they cannot comment
if (!allPolicies) {
return false;
}

// If we've made it here, commenting on this report is restricted.
// If the user is an admin, allow them to post.
const policy = allPolicies[`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`];
Expand Down

0 comments on commit 00a771f

Please sign in to comment.