diff --git a/src/components/LHNOptionsList/OptionRowLHN.js b/src/components/LHNOptionsList/OptionRowLHN.js index f83e0b834287..51d81b756e7a 100644 --- a/src/components/LHNOptionsList/OptionRowLHN.js +++ b/src/components/LHNOptionsList/OptionRowLHN.js @@ -152,7 +152,7 @@ function OptionRowLHN(props) { const statusClearAfterDate = lodashGet(optionItem, 'status.clearAfter', ''); const formattedDate = DateUtils.getStatusUntilDate(statusClearAfterDate); const statusContent = formattedDate ? `${statusText} (${formattedDate})` : statusText; - const isStatusVisible = Permissions.canUseCustomStatus(props.betas) && !!emojiCode && ReportUtils.isOneOnOneChat(optionItem); + const isStatusVisible = Permissions.canUseCustomStatus(props.betas) && !!emojiCode && ReportUtils.isOneOnOneChat(ReportUtils.getReport(optionItem.reportID)); const isGroupChat = optionItem.type === CONST.REPORT.TYPE.CHAT && _.isEmpty(optionItem.chatType) && !optionItem.isThread && lodashGet(optionItem, 'displayNamesWithTooltips.length', 0) > 2; diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 21c29a07ebae..28135c7fd3ca 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -772,6 +772,27 @@ function isMoneyRequestReport(reportOrID) { return isIOUReport(report) || isExpenseReport(report); } +/** + * Should return true only for personal 1:1 report + * + * @param {Object} report (chatReport or iouReport) + * @returns {boolean} + */ +function isOneOnOneChat(report) { + const participantAccountIDs = lodashGet(report, 'participantAccountIDs', []); + return ( + !isThread(report) && + !isChatRoom(report) && + !isExpenseRequest(report) && + !isMoneyRequestReport(report) && + !isPolicyExpenseChat(report) && + !isTaskReport(report) && + isDM(report) && + !isIOUReport(report) && + participantAccountIDs.length === 1 + ); +} + /** * Get the report given a reportID * @@ -2135,7 +2156,7 @@ function getParentNavigationSubtitle(report) { function navigateToDetailsPage(report) { const participantAccountIDs = lodashGet(report, 'participantAccountIDs', []); - if (isDM(report) && participantAccountIDs.length === 1) { + if (isOneOnOneChat(report)) { Navigation.navigate(ROUTES.PROFILE.getRoute(participantAccountIDs[0])); return; } @@ -3152,29 +3173,6 @@ function isIOUOwnedByCurrentUser(report, allReportsDict = null) { return reportToLook.ownerAccountID === currentUserAccountID; } -/** - * Should return true only for personal 1:1 report - * - * @param {Object} report (chatReport or iouReport) - * @returns {boolean} - */ -function isOneOnOneChat(report) { - const isChatRoomValue = lodashGet(report, 'isChatRoom', false); - const participantsListValue = lodashGet(report, 'participantsList', []); - return ( - !isThread(report) && - !isChatRoom(report) && - !isChatRoomValue && - !isExpenseRequest(report) && - !isMoneyRequestReport(report) && - !isPolicyExpenseChat(report) && - !isTaskReport(report) && - isDM(report) && - !isIOUReport(report) && - participantsListValue.length === 1 - ); -} - /** * Assuming the passed in report is a default room, lets us know whether we can see it or not, based on permissions and * the various subsets of users we've allowed to use default rooms.