Skip to content

Commit 7a7b1c1

Browse files
BeamanatorOSBotify
authored andcommitted
Merge pull request #24091 from dukenv0307/fix/22691-regression
[CP Staging] Fix user cannot open detail page of chat room (cherry picked from commit a67e8af)
1 parent 5ac39a1 commit 7a7b1c1

File tree

1 file changed

+32
-11
lines changed

1 file changed

+32
-11
lines changed

src/libs/ReportUtils.js

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -405,17 +405,6 @@ function isOptimisticPersonalDetail(accountID) {
405405
return _.isEmpty(allPersonalDetails[accountID]) || !!allPersonalDetails[accountID].isOptimisticPersonalDetail;
406406
}
407407

408-
/**
409-
* Check if report is a DM and personal detail of participant is optimistic data
410-
* @param {String} report
411-
* @returns {Boolean}
412-
*/
413-
function shouldDisableDetailPage(report) {
414-
const participants = lodashGet(report, 'participantAccountIDs', []);
415-
const isMultipleParticipant = participants.length > 1;
416-
return !isMultipleParticipant && isOptimisticPersonalDetail(participants[0]) && !report.parentReportID;
417-
}
418-
419408
/**
420409
* Checks if a report is a task report from a policy expense chat.
421410
*
@@ -461,6 +450,38 @@ function isConciergeChatReport(report) {
461450
}
462451

463452
/**
453+
<<<<<<< HEAD
454+
=======
455+
* Check if the report is a single chat report that isn't a thread
456+
* and personal detail of participant is optimistic data
457+
* @param {Object} report
458+
* @param {Array} report.participantAccountIDs
459+
* @returns {Boolean}
460+
*/
461+
function shouldDisableDetailPage(report) {
462+
const participantAccountIDs = lodashGet(report, 'participantAccountIDs', []);
463+
464+
if (isChatRoom(report) || isPolicyExpenseChat(report) || isChatThread(report)) {
465+
return false;
466+
}
467+
if (participantAccountIDs.length === 1) {
468+
return isOptimisticPersonalDetail(participantAccountIDs[0]);
469+
}
470+
return false;
471+
}
472+
473+
/**
474+
* Returns true if this report has only one participant and it's an Expensify account.
475+
* @param {Object} report
476+
* @returns {Boolean}
477+
*/
478+
function isExpensifyOnlyParticipantInReport(report) {
479+
const reportParticipants = _.without(lodashGet(report, 'participantAccountIDs', []), currentUserAccountID);
480+
return lodashGet(report, 'participantAccountIDs', []).length === 1 && _.some(reportParticipants, (accountID) => _.contains(CONST.EXPENSIFY_ACCOUNT_IDS, accountID));
481+
}
482+
483+
/**
484+
>>>>>>> a67e8af (Merge pull request #24091 from dukenv0307/fix/22691-regression)
464485
* Returns true if there are any Expensify accounts (i.e. with domain 'expensify.com') in the set of accountIDs
465486
* by cross-referencing the accountIDs with personalDetails.
466487
*

0 commit comments

Comments
 (0)