diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 0a333b2f1f39..28f861efa757 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -52,6 +52,7 @@ import AccountUtils from './AccountUtils'; import * as IOU from './actions/IOU'; import * as PolicyActions from './actions/Policy/Policy'; import * as store from './actions/ReimbursementAccount/store'; +import * as SessionUtils from './actions/Session'; import * as CurrencyUtils from './CurrencyUtils'; import DateUtils from './DateUtils'; import {hasValidDraftComment} from './DraftCommentUtils'; @@ -6930,6 +6931,10 @@ function canJoinChat(report: OnyxInputOrEntry, parentReportAction: OnyxI * Whether the user can leave a report */ function canLeaveChat(report: OnyxEntry, policy: OnyxEntry): boolean { + if (isPublicRoom(report) && SessionUtils.isAnonymousUser()) { + return false; + } + if (report?.notificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN) { return false; }