Skip to content

Commit

Permalink
Merge pull request #55374 from Expensify/revert-54868-fix/54211-hidde…
Browse files Browse the repository at this point in the history
…n-shows-when-creating-invoice

Revert "Fix hidden shows when sending invoice to new user"
  • Loading branch information
chiragsalian authored Jan 16, 2025
2 parents 784f3aa + 795c837 commit 0dacc30
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 181 deletions.
1 change: 0 additions & 1 deletion src/components/DisplayNames/index.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ function DisplayNames({accessibilityLabel, fullTitle, textStyles = [], numberOfL
accessibilityLabel={accessibilityLabel}
style={textStyles}
numberOfLines={numberOfLines}
testID={DisplayNames.displayName}
>
{fullTitle || translate('common.hidden')}
{renderAdditionalText?.()}
Expand Down
14 changes: 2 additions & 12 deletions src/components/ReportActionItem/ReportPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,6 @@ function ReportPreview({
const [invoiceReceiverPolicy] = useOnyx(
`${ONYXKEYS.COLLECTION.POLICY}${chatReport?.invoiceReceiver && 'policyID' in chatReport.invoiceReceiver ? chatReport.invoiceReceiver.policyID : CONST.DEFAULT_NUMBER_ID}`,
);
const [invoiceReceiverPersonalDetail] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {
selector: (personalDetails) =>
personalDetails?.[chatReport?.invoiceReceiver && 'accountID' in chatReport.invoiceReceiver ? chatReport.invoiceReceiver.accountID : CONST.DEFAULT_NUMBER_ID],
});
const theme = useTheme();
const styles = useThemeStyles();
const {translate} = useLocalize();
Expand Down Expand Up @@ -370,7 +366,7 @@ function ReportPreview({
if (isPolicyExpenseChat) {
payerOrApproverName = getPolicyName(chatReport, undefined, policy);
} else if (isInvoiceRoom) {
payerOrApproverName = getInvoicePayerName(chatReport, invoiceReceiverPolicy, invoiceReceiverPersonalDetail);
payerOrApproverName = getInvoicePayerName(chatReport, invoiceReceiverPolicy);
} else {
payerOrApproverName = getDisplayNameForParticipant(managerID, true);
}
Expand All @@ -393,7 +389,6 @@ function ReportPreview({
chatReport,
isInvoiceRoom,
invoiceReceiverPolicy,
invoiceReceiverPersonalDetail,
managerID,
isApproved,
iouSettled,
Expand Down Expand Up @@ -554,12 +549,7 @@ function ReportPreview({
<View style={styles.expenseAndReportPreviewTextContainer}>
<View style={styles.flexRow}>
<Animated.View style={[styles.flex1, styles.flexRow, styles.alignItemsCenter, previewMessageStyle]}>
<Text
style={[styles.textLabelSupporting, styles.lh20]}
testID="reportPreview-previewMessage"
>
{previewMessage}
</Text>
<Text style={[styles.textLabelSupporting, styles.lh20]}>{previewMessage}</Text>
</Animated.View>
{shouldShowRBR && (
<Icon
Expand Down
10 changes: 5 additions & 5 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4011,12 +4011,12 @@ function getAdminRoomInvitedParticipants(parentReportAction: OnyxEntry<ReportAct
* - Individual - a receiver display name.
* - Policy - a receiver policy name.
*/
function getInvoicePayerName(report: OnyxEntry<Report>, invoiceReceiverPolicy?: OnyxEntry<Policy>, invoiceReceiverPersonalDetail?: PersonalDetails): string {
function getInvoicePayerName(report: OnyxEntry<Report>, invoiceReceiverPolicy?: OnyxEntry<Policy>): string {
const invoiceReceiver = report?.invoiceReceiver;
const isIndividual = invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.INDIVIDUAL;

if (isIndividual) {
return formatPhoneNumber(getDisplayNameOrDefault(invoiceReceiverPersonalDetail ?? allPersonalDetails?.[invoiceReceiver.accountID]));
return formatPhoneNumber(getDisplayNameOrDefault(allPersonalDetails?.[invoiceReceiver.accountID]));
}

return getPolicyName(report, false, invoiceReceiverPolicy ?? allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${invoiceReceiver?.policyID}`]);
Expand Down Expand Up @@ -4095,7 +4095,7 @@ function getReportActionMessage(reportAction: OnyxEntry<ReportAction>, reportID?
/**
* Get the title for an invoice room.
*/
function getInvoicesChatName(report: OnyxEntry<Report>, receiverPolicy: OnyxEntry<Policy>, personalDetails?: Partial<PersonalDetailsList>): string {
function getInvoicesChatName(report: OnyxEntry<Report>, receiverPolicy: OnyxEntry<Policy>): string {
const invoiceReceiver = report?.invoiceReceiver;
const isIndividual = invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.INDIVIDUAL;
const invoiceReceiverAccountID = isIndividual ? invoiceReceiver.accountID : CONST.DEFAULT_NUMBER_ID;
Expand All @@ -4108,7 +4108,7 @@ function getInvoicesChatName(report: OnyxEntry<Report>, receiverPolicy: OnyxEntr
}

if (isIndividual) {
return formatPhoneNumber(getDisplayNameOrDefault((personalDetails ?? allPersonalDetails)?.[invoiceReceiverAccountID]));
return formatPhoneNumber(getDisplayNameOrDefault(allPersonalDetails?.[invoiceReceiverAccountID]));
}

return getPolicyName(report, false, invoiceReceiverPolicy);
Expand Down Expand Up @@ -4263,7 +4263,7 @@ function getReportName(
}

if (isInvoiceRoom(report)) {
formattedName = getInvoicesChatName(report, invoiceReceiverPolicy, personalDetails);
formattedName = getInvoicesChatName(report, invoiceReceiverPolicy);
}

if (isArchivedNonExpenseReport(report, getReportNameValuePairs(report?.reportID))) {
Expand Down
72 changes: 0 additions & 72 deletions tests/ui/components/HeaderViewTest.tsx

This file was deleted.

91 changes: 0 additions & 91 deletions tests/ui/components/ReportPreviewTest.tsx

This file was deleted.

0 comments on commit 0dacc30

Please sign in to comment.