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
2 changes: 1 addition & 1 deletion src/components/AvatarWithDisplayName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ function AvatarWithDisplayName({
const isReportArchived = useReportIsArchived(report?.reportID);
// This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850
// eslint-disable-next-line @typescript-eslint/no-deprecated
const title = getReportName(report, undefined, parentReportActionParam, personalDetails, invoiceReceiverPolicy, reportAttributes, undefined, isReportArchived);
const title = getReportName({report, parentReportActionParam, personalDetails, invoiceReceiverPolicy, reportAttributes, isReportArchived});
const isParentReportArchived = useReportIsArchived(report?.parentReportID);
const subtitle = getChatRoomSubtitle(report, true, isReportArchived);
const parentNavigationSubtitleData = getParentNavigationSubtitle(report, isParentReportArchived, reportAttributes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ function MoneyRequestReportPreviewContent({
>
{/* This will be fixed as follow up https://github.com/Expensify/App/pull/75357 */}
{/* eslint-disable-next-line @typescript-eslint/no-deprecated */}
{getReportName(iouReport, undefined, undefined, undefined, undefined, reportAttributes) || action.childReportName}
{getReportName({report: iouReport, reportAttributes}) || action.childReportName}
</Text>
</Animated.View>
</View>
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ModifiedExpenseMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ function getMovedFromOrToReportMessage(translate: LocalizedTranslate, movedFromR

if (movedFromReport) {
// eslint-disable-next-line @typescript-eslint/no-deprecated
const originReportName = getReportName(movedFromReport);
const originReportName = getReportName({report: movedFromReport});
return translate('iou.movedFromReport', originReportName ?? '');
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export default {
if (isRoomOrGroupChat) {
// Will be fixed in https://github.com/Expensify/App/issues/76852
// eslint-disable-next-line @typescript-eslint/no-deprecated
const roomName = ReportUtils.getReportName(report);
const roomName = ReportUtils.getReportName({report});
title = roomName;
body = `${plainTextPerson}: ${plainTextMessage}`;
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
}

let allReportActions: OnyxCollection<ReportActions>;
Onyx.connect({

Check warning on line 91 in src/libs/ReportActionsUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
waitForCollectionCallback: true,
callback: (actions) => {
Expand All @@ -100,7 +100,7 @@
});

let allReports: OnyxCollection<Report>;
Onyx.connect({

Check warning on line 103 in src/libs/ReportActionsUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -109,13 +109,13 @@
});

let isNetworkOffline = false;
Onyx.connect({

Check warning on line 112 in src/libs/ReportActionsUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.NETWORK,
callback: (val) => (isNetworkOffline = val?.isOffline ?? false),
});

let deprecatedCurrentUserAccountID: number | undefined;
Onyx.connect({

Check warning on line 118 in src/libs/ReportActionsUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.SESSION,
callback: (value) => {
// When signed out, value is undefined
Expand Down Expand Up @@ -1941,7 +1941,7 @@

const buildRoomElements = (): readonly MemberChangeMessageElement[] => {
// eslint-disable-next-line @typescript-eslint/no-deprecated
const roomName = getReportNameCallback(allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${originalMessage?.reportID}`]) || originalMessage?.roomName;
const roomName = getReportNameCallback({report: allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${originalMessage?.reportID}`]}) || originalMessage?.roomName;
if (roomName && originalMessage) {
const preposition = isInviteAction ? ` ${translate('workspace.invite.to')} ` : ` ${translate('workspace.invite.from')} `;

Expand Down
77 changes: 35 additions & 42 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -945,10 +945,15 @@
parentReportActionParam?: OnyxInputOrEntry<ReportAction>;
personalDetails?: Partial<PersonalDetailsList>;
invoiceReceiverPolicy?: OnyxEntry<Policy>;
/** Report attributes used to return a precomputed report name */
reportAttributes?: ReportAttributesDerivedValue['reports'];
transactions?: Transaction[];
reports?: Report[];
policies?: Policy[];
isReportArchived?: boolean;
// TODO: Make this required when https://github.com/Expensify/App/issues/66411 is done
/** Used to identify the Concierge chat so its name can be set to the Concierge display name */
conciergeReportID?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be really great if there were more explicit comments on the parameters in the type so people understand what their purpose is and when it's OK to pass it or not. Could you please add that for the two new parameters? Bonus points if you do it for all the parameters!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this PR, I just updated the GetReportNameParams type so I've added the comments for reportAttributes and conciergeReportID. Can you please check again?

};

type GetReportStatusParams = {
Expand Down Expand Up @@ -1015,7 +1020,7 @@
};

let conciergeReportIDOnyxConnect: OnyxEntry<string>;
Onyx.connect({

Check warning on line 1023 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.CONCIERGE_REPORT_ID,
callback: (value) => {
conciergeReportIDOnyxConnect = value;
Expand All @@ -1023,7 +1028,7 @@
});

const defaultAvatarBuildingIconTestID = 'SvgDefaultAvatarBuilding Icon';
Onyx.connect({

Check warning on line 1031 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.SESSION,
callback: (value) => {
// When signed out, val is undefined
Expand All @@ -1041,7 +1046,7 @@
let allPersonalDetails: OnyxEntry<PersonalDetailsList>;
let allPersonalDetailLogins: string[];
let currentUserPersonalDetails: OnyxEntry<PersonalDetails>;
Onyx.connect({

Check warning on line 1049 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
if (currentUserAccountID) {
Expand All @@ -1053,7 +1058,7 @@
});

let allReportsDraft: OnyxCollection<Report>;
Onyx.connect({

Check warning on line 1061 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_DRAFT,
waitForCollectionCallback: true,
callback: (value) => (allReportsDraft = value),
Expand All @@ -1062,7 +1067,7 @@
let allPolicies: OnyxCollection<Policy>;
let hasPolicies: boolean;
let policiesArray: Policy[] = [];
Onyx.connect({

Check warning on line 1070 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -1073,7 +1078,7 @@
});

let allPolicyDrafts: OnyxCollection<Policy>;
Onyx.connect({

Check warning on line 1081 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY_DRAFTS,
waitForCollectionCallback: true,
callback: (value) => (allPolicyDrafts = value),
Expand Down Expand Up @@ -5614,7 +5619,7 @@
if (match[1] !== childReportID) {
// This will be fixed as follow up https://github.com/Expensify/App/pull/75357
// eslint-disable-next-line @typescript-eslint/no-use-before-define, @typescript-eslint/no-deprecated
reportIDToName[match[1]] = getReportName(getReportOrDraftReport(match[1])) ?? '';
reportIDToName[match[1]] = getReportName({report: getReportOrDraftReport(match[1])}) ?? '';
}
}

Expand Down Expand Up @@ -5706,20 +5711,9 @@
* Get the title for a report.
* @deprecated Moved to src/libs/ReportNameUtils.ts.
*/
// eslint-disable-next-line @typescript-eslint/max-params
function getReportName(
report: OnyxEntry<Report>,
policy?: OnyxEntry<Policy>,
parentReportActionParam?: OnyxInputOrEntry<ReportAction>,
personalDetails?: Partial<PersonalDetailsList>,
invoiceReceiverPolicy?: OnyxEntry<Policy>,
reportAttributes?: ReportAttributesDerivedValue['reports'],
transactions?: Transaction[],
isReportArchived?: boolean,
reports?: Report[],
policies?: Policy[],
conciergeReportID?: string,
): string {
function getReportName(reportNameInformation: GetReportNameParams): string {
const {report, policy, parentReportActionParam, personalDetails, invoiceReceiverPolicy, reportAttributes, transactions, isReportArchived, reports, policies, conciergeReportID} =
reportNameInformation;
// Check if we can use report name in derived values - only when we have report but no other params
const canUseDerivedValue =
report && policy === undefined && parentReportActionParam === undefined && personalDetails === undefined && invoiceReceiverPolicy === undefined && isReportArchived === undefined;
Expand Down Expand Up @@ -5753,7 +5747,7 @@
const {originalID} = getOriginalMessage(parentReportAction) ?? {};
const originalReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${originalID}`];
// eslint-disable-next-line @typescript-eslint/no-deprecated -- temporarily disabling rule for deprecated functions out of issue scope
const reportName = getReportName(originalReport);
const reportName = getReportName({report: originalReport});
// eslint-disable-next-line @typescript-eslint/no-deprecated -- temporarily disabling rule for deprecated functions out of issue scope
return getCreatedReportForUnapprovedTransactionsMessage(originalID, reportName, translateLocal);
}
Expand Down Expand Up @@ -5934,18 +5928,17 @@

if (isExpenseReport(currentParent)) {
// eslint-disable-next-line @typescript-eslint/no-deprecated
return getReportName(
currentParent,
return getReportName({
report: currentParent,
policy,
props.parentReportActionParam,
props.personalDetails,
props.invoiceReceiverPolicy,
undefined,
props.transactions,
props.isReportArchived,
props.reports,
props.policies,
);
parentReportActionParam: props.parentReportActionParam,
personalDetails: props.personalDetails,
invoiceReceiverPolicy: props.invoiceReceiverPolicy,
transactions: props.transactions,
isReportArchived: props.isReportArchived,
reports: props.reports,
policies: props.policies,
});
}

// Continue traversing up the parent chain
Expand All @@ -5956,18 +5949,17 @@
}
// This will be fixed as follow up https://github.com/Expensify/App/pull/75357
// eslint-disable-next-line @typescript-eslint/no-deprecated
return getReportName(
return getReportName({
report,
policy,
props.parentReportActionParam,
props.personalDetails,
props.invoiceReceiverPolicy,
undefined,
props.transactions,
props.isReportArchived,
props.reports,
props.policies,
);
parentReportActionParam: props.parentReportActionParam,
personalDetails: props.personalDetails,
invoiceReceiverPolicy: props.invoiceReceiverPolicy,
transactions: props.transactions,
isReportArchived: props.isReportArchived,
reports: props.reports,
policies: props.policies,
});
}

/**
Expand Down Expand Up @@ -6110,7 +6102,7 @@
return {
// This will be fixed as follow up https://github.com/Expensify/App/pull/75357
// eslint-disable-next-line @typescript-eslint/no-deprecated
reportName: getReportName(parentReport, undefined, undefined, undefined, undefined, reportAttributes),
reportName: getReportName({report: parentReport, reportAttributes}),
workspaceName: getPolicyName({report: parentReport, returnEmptyIfNotFound: true}),
};
}
Expand Down Expand Up @@ -6857,7 +6849,7 @@

// This will be fixed as follow up https://github.com/Expensify/App/pull/75357
// eslint-disable-next-line @typescript-eslint/no-deprecated
const reportName = Parser.htmlToText(getReportName(report) ?? report?.reportName ?? '');
const reportName = Parser.htmlToText(getReportName({report}) ?? report?.reportName ?? '');
const reportUrl = getReportURLForCurrentContext(report?.reportID);
if (typeof fromReportID === 'undefined') {
return translate('iou.movedTransactionTo', reportUrl, reportName);
Expand All @@ -6873,7 +6865,7 @@

// This will be fixed as follow up https://github.com/Expensify/App/pull/75357
// eslint-disable-next-line @typescript-eslint/no-deprecated
const reportName = Parser.htmlToText(getReportName(fromReport) ?? fromReport?.reportName ?? '');
const reportName = Parser.htmlToText(getReportName({report: fromReport}) ?? fromReport?.reportName ?? '');

let reportUrl = getReportURLForCurrentContext(fromReportID);

Expand Down Expand Up @@ -12514,12 +12506,12 @@
if (report?.reportID) {
// This will be fixed as follow up https://github.com/Expensify/App/pull/75357
// eslint-disable-next-line @typescript-eslint/no-deprecated
return getReportName(getReport(report?.reportID, allReports));
return getReportName({report: getReport(report?.reportID, allReports)});
}

// This will be fixed as follow up https://github.com/Expensify/App/pull/75357
// eslint-disable-next-line @typescript-eslint/no-deprecated
return getReportName(report);
return getReportName({report});
}

/**
Expand Down Expand Up @@ -13338,4 +13330,5 @@
SelfDMParameters,
OptimisticReportAction,
OptimisticAnnounceChat,
GetReportNameParams,
};
2 changes: 1 addition & 1 deletion src/libs/SearchQueryUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,7 @@ function getFilterDisplayValue(
}
if (filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.IN) {
// eslint-disable-next-line @typescript-eslint/no-deprecated
return getReportName(reports?.[`${ONYXKEYS.COLLECTION.REPORT}${filterValue}`]) || filterValue;
return getReportName({report: reports?.[`${ONYXKEYS.COLLECTION.REPORT}${filterValue}`]}) || filterValue;
}
if (filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.AMOUNT || filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.TOTAL || filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.PURCHASE_AMOUNT) {
const frontendAmount = convertToFrontendAmountAsInteger(Number(filterValue));
Expand Down
2 changes: 1 addition & 1 deletion src/libs/SearchUIUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1992,7 +1992,7 @@ function getTaskSections(
const policy = data[`${ONYXKEYS.COLLECTION.POLICY}${parentReport.policyID}`];
const isParentReportArchived = archivedReportsIDList?.has(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${parentReport?.reportID}`);
// eslint-disable-next-line @typescript-eslint/no-deprecated
const parentReportName = getReportName(parentReport, policy, undefined, undefined, undefined, undefined, undefined, isParentReportArchived);
const parentReportName = getReportName({report: parentReport, policy, isReportArchived: isParentReportArchived});
const icons = getIcons(parentReport, formatPhoneNumber, personalDetails, null, '', -1, policy, undefined, isParentReportArchived);
const parentReportIcon = icons?.at(0);

Expand Down
8 changes: 4 additions & 4 deletions src/libs/SidebarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ function categorizeReportsForLHN(

const reportID = report.reportID;
// eslint-disable-next-line @typescript-eslint/no-deprecated
const displayName = getReportName(report, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, conciergeReportID);
const displayName = getReportName({report, conciergeReportID});
const miniReport: MiniReport = {
reportID,
displayName,
Expand Down Expand Up @@ -880,7 +880,7 @@ function getOptionData({
const users = translate(targetAccountIDsLength > 1 ? 'common.members' : 'common.member')?.toLocaleLowerCase();
result.alternateText = formatReportLastMessageText(`${actorDisplayName ?? lastActorDisplayName}: ${verb} ${targetAccountIDsLength} ${users}`);
// eslint-disable-next-line @typescript-eslint/no-deprecated
const roomName = getReportName(lastActionReport) || lastActionOriginalMessage?.roomName;
const roomName = getReportName({report: lastActionReport}) || lastActionOriginalMessage?.roomName;
if (roomName) {
const preposition =
lastAction.actionName === CONST.REPORT.ACTIONS.TYPE.ROOM_CHANGE_LOG.INVITE_TO_ROOM || lastAction.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.INVITE_TO_ROOM
Expand Down Expand Up @@ -1127,7 +1127,7 @@ function getOptionData({
}

// eslint-disable-next-line @typescript-eslint/no-deprecated
const reportName = getReportName(report, policy, undefined, undefined, invoiceReceiverPolicy, undefined, undefined, isReportArchived, undefined, undefined, conciergeReportID);
const reportName = getReportName({report, policy, invoiceReceiverPolicy, isReportArchived, conciergeReportID});

result.text = reportName;
result.subtitle = subtitle;
Expand Down Expand Up @@ -1237,7 +1237,7 @@ function getRoomWelcomeMessage(
const welcomeMessage: WelcomeMessage = {};
const workspaceName = getPolicyName({report});
// eslint-disable-next-line @typescript-eslint/no-deprecated
const reportName = getReportName(report);
const reportName = getReportName({report});

if (report?.description) {
welcomeMessage.messageHtml = getReportDescription(report);
Expand Down
2 changes: 1 addition & 1 deletion src/libs/actions/Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ function getShareDestination(
icons: ReportUtils.getIcons(report, LocalePhoneNumber.formatPhoneNumber, personalDetails, Expensicons.FallbackAvatar),
// Will be fixed in https://github.com/Expensify/App/issues/76852
// eslint-disable-next-line @typescript-eslint/no-deprecated
displayName: ReportUtils.getReportName(report),
displayName: ReportUtils.getReportName({report}),
subtitle,
displayNamesWithTooltips,
shouldUseFullTitleToDisplay: ReportUtils.shouldUseFullTitleToDisplay(report),
Expand Down
2 changes: 1 addition & 1 deletion src/pages/RoomInvitePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ function RoomInvitePage({
const backRoute = reportID && (!isPolicyEmployee || isReportArchived ? ROUTES.REPORT_WITH_ID_DETAILS.getRoute(reportID, backTo) : ROUTES.ROOM_MEMBERS.getRoute(reportID, backTo));

// eslint-disable-next-line @typescript-eslint/no-deprecated
const reportName = getReportName(report);
const reportName = getReportName({report});

const ancestors = useAncestors(report);

Expand Down
2 changes: 1 addition & 1 deletion src/pages/RoomMembersPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ function RoomMembersPage({report, policy}: RoomMembersPageProps) {
<HeaderWithBackButton
title={selectionModeHeader ? translate('common.selectMultiple') : translate('workspace.common.members')}
// eslint-disable-next-line @typescript-eslint/no-deprecated
subtitle={StringUtils.lineBreaksToSpaces(shouldParserToHTML ? Parser.htmlToText(getReportName(reportForSubtitle)) : getReportName(reportForSubtitle))}
subtitle={StringUtils.lineBreaksToSpaces(shouldParserToHTML ? Parser.htmlToText(getReportName({report: reportForSubtitle})) : getReportName({report: reportForSubtitle}))}
onBackButtonPress={() => {
if (isMobileSelectionModeEnabled) {
setSelectedMembers([]);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ShareCodePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function ShareCodePage({report, policy, backTo}: ShareCodePageProps) {
const reportForTitle = useMemo(() => getReportForHeader(report), [report]);

// eslint-disable-next-line @typescript-eslint/no-deprecated
const title = isReport ? getReportName(reportForTitle) : (currentUserPersonalDetails.displayName ?? '');
const title = isReport ? getReportName({report: reportForTitle}) : (currentUserPersonalDetails.displayName ?? '');
const urlWithTrailingSlash = addTrailingForwardSlash(environmentURL);
const url = isReport
? `${urlWithTrailingSlash}${ROUTES.REPORT_WITH_ID.getRoute(report.reportID)}`
Expand Down
3 changes: 2 additions & 1 deletion src/pages/TripChatNameEditPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ function TripChatNameEditPage({report}: TripChatNameEditPageProps) {
const {inputCallbackRef} = useAutoFocusInput();

const reportID = report?.reportID;
const currentChatName = getReportName(report);
// eslint-disable-next-line @typescript-eslint/no-deprecated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ CONSISTENCY-5 (docs)

This newly added eslint-disable-next-line lacks a justification comment explaining why the rule is disabled. Other files in this PR include tracking comments (e.g., // This will be fixed as follow up https://github.com/Expensify/App/pull/75357).

Add a comment above or on the same line explaining the reason for the disable, for example:

// This will be fixed as follow up https://github.com/Expensify/App/pull/75357
// eslint-disable-next-line @typescript-eslint/no-deprecated
const currentChatName = getReportName({report});

Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore lint check because we just need to refactor the getReportName function

const currentChatName = getReportName({report});

const validate = (values: FormOnyxValues<typeof ONYXKEYS.FORMS.NEW_CHAT_NAME_FORM>): Errors => {
const errors: Errors = {};
Expand Down
4 changes: 2 additions & 2 deletions src/pages/inbox/sidebar/FloatingActionButtonAndPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, ref

const quickActionSubtitle = useMemo(() => {
// eslint-disable-next-line @typescript-eslint/no-deprecated
return !hideQABSubtitle ? (getReportName(quickActionReport, quickActionPolicy, undefined, personalDetails) ?? translate('quickAction.updateDestination')) : '';
return !hideQABSubtitle ? (getReportName({report: quickActionReport, policy: quickActionPolicy, personalDetails}) ?? translate('quickAction.updateDestination')) : '';
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [hideQABSubtitle, personalDetails, quickAction?.action, quickActionPolicy?.name, quickActionReport, translate]);

Expand Down Expand Up @@ -529,7 +529,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, ref
icon: icons.ReceiptScan,
text: translate('quickAction.scanReceipt'),
// eslint-disable-next-line @typescript-eslint/no-deprecated
description: getReportName(policyChatForActivePolicy),
description: getReportName({report: policyChatForActivePolicy}),
shouldCallAfterModalHide: shouldUseNarrowLayout,
onSelected,
rightIconReportID: policyChatForActivePolicy?.reportID,
Expand Down
Loading
Loading