Skip to content

Commit

Permalink
Merge pull request #24091 from dukenv0307/fix/22691-regression
Browse files Browse the repository at this point in the history
[CP Staging] Fix user cannot open detail page of chat room
  • Loading branch information
Beamanator committed Aug 4, 2023
2 parents 4f308c4 + e8c1e86 commit a67e8af
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,17 +405,6 @@ function isOptimisticPersonalDetail(accountID) {
return _.isEmpty(allPersonalDetails[accountID]) || !!allPersonalDetails[accountID].isOptimisticPersonalDetail;
}

/**
* Check if report is a DM and personal detail of participant is optimistic data
* @param {String} report
* @returns {Boolean}
*/
function shouldDisableDetailPage(report) {
const participants = lodashGet(report, 'participantAccountIDs', []);
const isMultipleParticipant = participants.length > 1;
return !isMultipleParticipant && isOptimisticPersonalDetail(participants[0]) && !report.parentReportID;
}

/**
* Checks if a report is a task report from a policy expense chat.
*
Expand Down Expand Up @@ -460,6 +449,25 @@ function isConciergeChatReport(report) {
return lodashGet(report, 'participantAccountIDs', []).length === 1 && Number(report.participantAccountIDs[0]) === CONST.ACCOUNT_ID.CONCIERGE && !isChatThread(report);
}

/**
* Check if the report is a single chat report that isn't a thread
* and personal detail of participant is optimistic data
* @param {Object} report
* @param {Array} report.participantAccountIDs
* @returns {Boolean}
*/
function shouldDisableDetailPage(report) {
const participantAccountIDs = lodashGet(report, 'participantAccountIDs', []);

if (isChatRoom(report) || isPolicyExpenseChat(report) || isChatThread(report)) {
return false;
}
if (participantAccountIDs.length === 1) {
return isOptimisticPersonalDetail(participantAccountIDs[0]);
}
return false;
}

/**
* Returns true if this report has only one participant and it's an Expensify account.
* @param {Object} report
Expand Down

0 comments on commit a67e8af

Please sign in to comment.