Skip to content
Merged
Show file tree
Hide file tree
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
26 changes: 24 additions & 2 deletions src/libs/OptionsListUtils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1332,6 +1332,7 @@ function getReportDisplayOption(
privateIsArchived: boolean | undefined,
policy: OnyxEntry<Policy>,
translate: LocalizedTranslate,
currentUserAccountID: number,
reportAttributesDerived?: ReportAttributesDerivedValue['reports'],
policyTags?: OnyxEntry<PolicyTagLists>,
visibleReportActionsData: VisibleReportActionsDerivedValue = {},
Expand All @@ -1351,6 +1352,7 @@ function getReportDisplayOption(
reportAttributesDerived,
policyTags,
visibleReportActionsData,
currentUserAccountID,
});

// Update text & alternateText because createOption returns workspace name only if report is owned by the user
Expand Down Expand Up @@ -1383,6 +1385,7 @@ function getPolicyExpenseReportOption(
expenseReport: OnyxEntry<Report>,
policy: OnyxEntry<Policy>,
translate: LocalizedTranslate,
currentUserAccountID: number,
reportAttributesDerived?: ReportAttributesDerivedValue['reports'],
policyTags?: OnyxEntry<PolicyTagLists>,
visibleReportActionsData: VisibleReportActionsDerivedValue = {},
Expand All @@ -1404,6 +1407,7 @@ function getPolicyExpenseReportOption(
reportAttributesDerived,
policyTags,
visibleReportActionsData,
currentUserAccountID,
});

// Update text & alternateText because createOption returns workspace name only if report is owned by the user
Expand Down Expand Up @@ -3121,7 +3125,16 @@ function formatSectionsFromSearchTerm(
const expenseReport = getReportByID(participant.reportID);
const privateIsArchived = privateIsArchivedMap[`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${expenseReport?.reportID}`];
const expenseReportPolicy = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${expenseReport?.policyID}`];
return getPolicyExpenseReportOption(participant, privateIsArchived, personalDetails, expenseReport, expenseReportPolicy, translate, reportAttributesDerived);
return getPolicyExpenseReportOption(
participant,
privateIsArchived,
personalDetails,
expenseReport,
expenseReportPolicy,
translate,
currentUserAccountID,
reportAttributesDerived,
);
}
return getParticipantsOption(participant, personalDetails, translate);
})
Expand Down Expand Up @@ -3153,7 +3166,16 @@ function formatSectionsFromSearchTerm(
const expenseReport = getReportByID(participant.reportID);
const privateIsArchived = privateIsArchivedMap[`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${expenseReport?.reportID}`];
const expenseReportPolicy = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${expenseReport?.policyID}`];
return getPolicyExpenseReportOption(participant, privateIsArchived, personalDetails, expenseReport, expenseReportPolicy, translate, reportAttributesDerived);
return getPolicyExpenseReportOption(
participant,
privateIsArchived,
personalDetails,
expenseReport,
expenseReportPolicy,
translate,
currentUserAccountID,
reportAttributesDerived,
);
}
return getParticipantsOption(participant, personalDetails, translate);
})
Expand Down
5 changes: 3 additions & 2 deletions src/pages/Share/ShareDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ function ShareDetailsPage({route}: ShareDetailsPageProps) {
const privateIsArchived = useReportIsArchived(report?.reportID);
const ancestors = useAncestors(report);
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`);
const currentUserAccountID = personalDetail?.accountID ?? CONST.DEFAULT_NUMBER_ID;
const displayReport = useMemo(
() => getReportDisplayOption(report, unknownUserDetails, personalDetails, privateIsArchived, policy, translate, reportAttributesDerived),
[report, unknownUserDetails, personalDetails, privateIsArchived, reportAttributesDerived, policy, translate],
() => getReportDisplayOption(report, unknownUserDetails, personalDetails, privateIsArchived, policy, translate, currentUserAccountID, reportAttributesDerived),
[report, unknownUserDetails, personalDetails, privateIsArchived, policy, currentUserAccountID, reportAttributesDerived, translate],
);

const shouldShowAttachment = !isTextShared;
Expand Down
11 changes: 10 additions & 1 deletion src/pages/iou/DynamicSplitBillDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,16 @@ function DynamicSplitBillDetailsPage({report, reportAction}: SplitBillDetailsPag
if (isPolicyExpenseChat(report)) {
participants = [
getParticipantsOption({accountID: participantAccountIDs.at(0), selected: true, reportID: ''}, personalDetails, translate),
getPolicyExpenseReportOption({...report, selected: true, reportID}, privateIsArchived, personalDetails, report, policy, translate, reportAttributesDerived),
getPolicyExpenseReportOption(
{...report, selected: true, reportID},
privateIsArchived,
personalDetails,
report,
policy,
translate,
session?.accountID ?? CONST.DEFAULT_NUMBER_ID,
reportAttributesDerived,
),
];
} else {
participants = participantAccountIDs.map((accountID) => getParticipantsOption({accountID, selected: true, reportID: ''}, personalDetails, translate));
Expand Down
1 change: 1 addition & 0 deletions src/pages/iou/request/ParticipantSearchResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ function ParticipantSearchResults({
userToInviteExpenseReport,
userToInviteExpenseReportPolicy,
translate,
currentUserAccountID,
reportAttributesDerived,
)
: getParticipantsOption(participant, personalDetails, translate);
Expand Down
Loading
Loading