Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CP Staging] Fix user cannot open detail page of chat room #24091

Merged
merged 8 commits into from
Aug 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)) {
Beamanator marked this conversation as resolved.
Show resolved Hide resolved
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
Loading