Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
3327196
Add utils to check harvest report and get originalID
hoangzinh Nov 19, 2025
ce26920
Display created action for harvest expense reports
hoangzinh Nov 19, 2025
dbf6eeb
Fix translation key
hoangzinh Nov 19, 2025
a2f2bde
only return CONCIERGE ID for harvest created expense report
hoangzinh Nov 20, 2025
a5c5f9d
Fix bug, incorrect report id
hoangzinh Nov 20, 2025
8967b60
Add tests for harvest-created reports and CREATED action visibility
hoangzinh Nov 20, 2025
9ba2172
Context menu: copy harvest-created CREATED action as localized summar…
hoangzinh Nov 20, 2025
793e382
feat(i18n): add HarvestCreatedExpenseReportParams import and translat…
hoangzinh Nov 20, 2025
bbfb1cb
Fix linter
hoangzinh Nov 20, 2025
d55abef
chore(i18n): include reportUrl in HarvestCreatedExpenseReportParams a…
hoangzinh Nov 20, 2025
65e2025
Fix type error
hoangzinh Nov 20, 2025
3d8b12c
Fix type error
hoangzinh Nov 20, 2025
d11506f
Add unit test for getHarvestCreatedExpenseReportMessage
hoangzinh Nov 20, 2025
90e1db5
perf: optimize React.memo comparison and fix stale closure
hoangzinh Nov 21, 2025
c6628b1
Merge branch 'main' into 74580-show-created-action-for-harvest-expens…
hoangzinh Nov 21, 2025
b20161b
Merge branch 'main' into 74580-show-created-action-for-harvest-expens…
hoangzinh Dec 2, 2025
358e6ef
Run prettier
hoangzinh Dec 2, 2025
21c1b53
Merge branch 'main' into 74580-show-created-action-for-harvest-expens…
hoangzinh Dec 3, 2025
b890608
refactor: update harvestCreatedExpenseReport to use reportName instea…
hoangzinh Dec 3, 2025
d14c02b
refactor: pass reportNameValuePairs as separate props for better perf…
hoangzinh Dec 3, 2025
dd5751b
Fix eslint
hoangzinh Dec 3, 2025
e09c019
Merge branch 'main' into 74580-show-created-action-for-harvest-expens…
hoangzinh Dec 4, 2025
a978219
refactor: extract getReportURLForCurrentContext to navigation helper
hoangzinh Dec 4, 2025
068e15e
fix: show harvest created expense report action in LHN
hoangzinh Dec 5, 2025
0cedc66
fix: show harvest created expense report action in one-transaction view
hoangzinh Dec 5, 2025
fefd125
Hide leave thread for harvest created action
hoangzinh Dec 5, 2025
8091288
refactor: use isHarvestReport flag instead of reportNameValuePairs in…
hoangzinh Dec 5, 2025
2b6891e
Run prettier
hoangzinh Dec 5, 2025
803326c
fix: UI is blink for harvest created one transaction report
hoangzinh Dec 7, 2025
6f17bd6
Merge branch 'main' into 74580-show-created-action-for-harvest-expens…
hoangzinh Dec 7, 2025
f60382e
Fix merge main
hoangzinh Dec 7, 2025
a849805
Apply suggestions from code review
hoangzinh Dec 8, 2025
2ab32b4
Refactor as suggested.
hoangzinh Dec 8, 2025
65ca1c6
Run prettier
hoangzinh Dec 8, 2025
cc1046d
Merge branch 'main' into 74580-show-created-action-for-harvest-expens…
hoangzinh Dec 9, 2025
aa2b2c2
Fix eslint
hoangzinh Dec 9, 2025
221acc1
Run prettier
hoangzinh Dec 9, 2025
da37ec7
Merge branch 'main' into 74580-show-created-action-for-harvest-expens…
hoangzinh Dec 11, 2025
1dfb917
Use getNonEmptyStringOnyxID
hoangzinh Dec 11, 2025
06b9ed4
Fix render repeated MoneyRequestView
hoangzinh Dec 11, 2025
c215ffd
fix: hide join thread option for harvest created expense reports
hoangzinh Dec 12, 2025
cbcaa7b
Merge branch 'main' into 74580-show-created-action-for-harvest-expens…
hoangzinh Dec 12, 2025
302a04f
revert: harvest created expense report message in LHN
hoangzinh Dec 12, 2025
42840d9
Merge branch 'main' into 74580-show-created-action-for-harvest-expens…
hoangzinh Dec 15, 2025
124ab7b
Fix react-compiler-compliance-check
hoangzinh Dec 15, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import {
shouldReportActionBeVisible,
wasMessageReceivedWhileOffline,
} from '@libs/ReportActionsUtils';
import {canUserPerformWriteAction, chatIncludesChronosWithID, getOriginalReportID, getReportLastVisibleActionCreated, isUnread} from '@libs/ReportUtils';
import {canUserPerformWriteAction, chatIncludesChronosWithID, getOriginalReportID, getReportLastVisibleActionCreated, isHarvestCreatedExpenseReport, isUnread} from '@libs/ReportUtils';
import markOpenReportEnd from '@libs/telemetry/markOpenReportEnd';
import {isTransactionPendingDelete} from '@libs/TransactionUtils';
import Visibility from '@libs/Visibility';
Expand Down Expand Up @@ -175,6 +175,8 @@ function MoneyRequestReportActionsList({
const {shouldUseNarrowLayout} = useResponsiveLayout();

const [session] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: false});
const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${getNonEmptyStringOnyxID(reportID)}`, {canBeMissing: true});
const shouldShowHarvestCreatedAction = isHarvestCreatedExpenseReport(reportNameValuePairs?.origin, reportNameValuePairs?.originalID);
const [offlineModalVisible, setOfflineModalVisible] = useState(false);
const [isDownloadErrorModalVisible, setIsDownloadErrorModalVisible] = useState(false);
const [enableScrollToEnd, setEnableScrollToEnd] = useState<boolean>(false);
Expand Down Expand Up @@ -222,7 +224,7 @@ function MoneyRequestReportActionsList({
// We are reversing actions because in this View we are starting at the top and don't use Inverted list
const visibleReportActions = useMemo(() => {
const filteredActions = reportActions.filter((reportAction) => {
const isActionVisibleOnMoneyReport = isActionVisibleOnMoneyRequestReport(reportAction);
const isActionVisibleOnMoneyReport = isActionVisibleOnMoneyRequestReport(reportAction, shouldShowHarvestCreatedAction);

return (
isActionVisibleOnMoneyReport &&
Expand All @@ -233,7 +235,7 @@ function MoneyRequestReportActionsList({
});

return filteredActions.toReversed();
}, [reportActions, isOffline, canPerformWriteAction, reportTransactionIDs]);
}, [reportActions, isOffline, canPerformWriteAction, reportTransactionIDs, shouldShowHarvestCreatedAction]);

const reportActionSize = useRef(visibleReportActions.length);
const lastAction = visibleReportActions.at(-1);
Expand Down Expand Up @@ -578,6 +580,8 @@ function MoneyRequestReportActionsList({
isReportArchived={isReportArchived}
draftMessage={matchingDraftMessageString}
Comment thread
hoangzinh marked this conversation as resolved.
Resolved
isTryNewDotNVPDismissed={isTryNewDotNVPDismissed}
reportNameValuePairsOrigin={reportNameValuePairs?.origin}
reportNameValuePairsOriginalID={reportNameValuePairs?.originalID}
/>
);
},
Expand All @@ -601,6 +605,8 @@ function MoneyRequestReportActionsList({
draftMessage,
isTryNewDotNVPDismissed,
isReportArchived,
reportNameValuePairs?.origin,
reportNameValuePairs?.originalID,
],
);

Expand Down
3 changes: 3 additions & 0 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ import type {
FocusModeUpdateParams,
FormattedMaxLengthParams,
GoBackMessageParams,
HarvestCreatedExpenseReportParams,
ImportedTagsMessageParams,
ImportedTypesParams,
ImportFieldParams,
Expand Down Expand Up @@ -1015,6 +1016,8 @@ const translations: TranslationDeepObject<typeof en> = {
adminOnlyCanPost: 'Nur Administratoren können Nachrichten in diesem Raum senden.',
reportAction: {
asCopilot: 'als Copilot für',
harvestCreatedExpenseReport: ({reportUrl, reportName}: HarvestCreatedExpenseReportParams) =>
`hat diesen Bericht erstellt, um alle Ausgaben aus <a href="${reportUrl}">${reportName}</a> aufzunehmen, die mit der von dir gewählten Frequenz nicht eingereicht werden konnten`,
},
mentionSuggestions: {
hereAlternateText: 'Alle in dieser Unterhaltung benachrichtigen',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ import type {
FocusModeUpdateParams,
FormattedMaxLengthParams,
GoBackMessageParams,
HarvestCreatedExpenseReportParams,
ImportedTagsMessageParams,
ImportedTypesParams,
ImportFieldParams,
Expand Down Expand Up @@ -999,6 +1000,8 @@ const translations = {
adminOnlyCanPost: 'Only admins can send messages in this room.',
reportAction: {
asCopilot: 'as copilot for',
harvestCreatedExpenseReport: ({reportUrl, reportName}: HarvestCreatedExpenseReportParams) =>
`created this report to hold all expenses from <a href="${reportUrl}">${reportName}</a> that couldn't be submitted on your chosen frequency`,
},
mentionSuggestions: {
hereAlternateText: 'Notify everyone in this conversation',
Expand Down
4 changes: 3 additions & 1 deletion src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {CONST as COMMON_CONST} from 'expensify-common';
import dedent from '@libs/StringUtils/dedent';
import CONST from '@src/CONST';
import type en from './en';
import type {BeginningOfChatHistoryParams, TagSelectionParams, ViolationsRterParams} from './params';
import type {BeginningOfChatHistoryParams, HarvestCreatedExpenseReportParams, TagSelectionParams, ViolationsRterParams} from './params';
import type {TranslationDeepObject} from './types';

/* eslint-disable max-len */
Expand Down Expand Up @@ -636,6 +636,8 @@ const translations: TranslationDeepObject<typeof en> = {
adminOnlyCanPost: 'Solo los administradores pueden enviar mensajes en esta sala.',
reportAction: {
asCopilot: 'como copiloto de',
harvestCreatedExpenseReport: ({reportUrl, reportName}: HarvestCreatedExpenseReportParams) =>
`creó este informe para contener todos los gastos de <a href="${reportUrl}">${reportName}</a> que no se pudieron enviar con la frecuencia que elegiste`,
},
mentionSuggestions: {
hereAlternateText: 'Notificar a todos en esta conversación',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ import type {
FocusModeUpdateParams,
FormattedMaxLengthParams,
GoBackMessageParams,
HarvestCreatedExpenseReportParams,
ImportedTagsMessageParams,
ImportedTypesParams,
ImportFieldParams,
Expand Down Expand Up @@ -1017,6 +1018,8 @@ const translations: TranslationDeepObject<typeof en> = {
adminOnlyCanPost: 'Seuls les administrateurs peuvent envoyer des messages dans cette salle.',
reportAction: {
asCopilot: 'en tant que copilote pour',
harvestCreatedExpenseReport: ({reportUrl, reportName}: HarvestCreatedExpenseReportParams) =>
`a créé ce rapport pour regrouper toutes les dépenses de <a href="${reportUrl}">${reportName}</a> qui n'ont pas pu être soumises selon la fréquence que vous avez choisie`,
},
mentionSuggestions: {
hereAlternateText: 'Notifier tout le monde dans cette conversation',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ import type {
FocusModeUpdateParams,
FormattedMaxLengthParams,
GoBackMessageParams,
HarvestCreatedExpenseReportParams,
ImportedTagsMessageParams,
ImportedTypesParams,
ImportFieldParams,
Expand Down Expand Up @@ -1015,6 +1016,8 @@ const translations: TranslationDeepObject<typeof en> = {
adminOnlyCanPost: 'Solo gli amministratori possono inviare messaggi in questa stanza.',
reportAction: {
asCopilot: 'come copilota per',
harvestCreatedExpenseReport: ({reportUrl, reportName}: HarvestCreatedExpenseReportParams) =>
`ha creato questo rapporto per raccogliere tutte le spese di <a href="${reportUrl}">${reportName}</a> che non sono state inviate con la frequenza scelta`,
},
mentionSuggestions: {
hereAlternateText: 'Notifica tutti in questa conversazione',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ import type {
FocusModeUpdateParams,
FormattedMaxLengthParams,
GoBackMessageParams,
HarvestCreatedExpenseReportParams,
ImportedTagsMessageParams,
ImportedTypesParams,
ImportFieldParams,
Expand Down Expand Up @@ -1014,6 +1015,8 @@ const translations: TranslationDeepObject<typeof en> = {
adminOnlyCanPost: 'このルームでメッセージを送信できるのは管理者のみです。',
reportAction: {
asCopilot: 'のコパイロットとして',
harvestCreatedExpenseReport: ({reportUrl, reportName}: HarvestCreatedExpenseReportParams) =>
`選択した頻度では提出できなかった <a href="${reportUrl}">${reportName}</a> のすべての経費をまとめるためにこのレポートを作成しました`,
},
mentionSuggestions: {
hereAlternateText: 'この会話の全員に通知',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ import type {
FocusModeUpdateParams,
FormattedMaxLengthParams,
GoBackMessageParams,
HarvestCreatedExpenseReportParams,
ImportedTagsMessageParams,
ImportedTypesParams,
ImportFieldParams,
Expand Down Expand Up @@ -1014,6 +1015,8 @@ const translations: TranslationDeepObject<typeof en> = {
adminOnlyCanPost: 'Alleen beheerders kunnen berichten sturen in deze ruimte.',
reportAction: {
asCopilot: 'als copiloot voor',
harvestCreatedExpenseReport: ({reportUrl, reportName}: HarvestCreatedExpenseReportParams) =>
`heeft dit rapport aangemaakt om alle uitgaven van <a href="${reportUrl}">${reportName}</a> op te nemen die niet konden worden ingediend met de door jou gekozen frequentie`,
},
mentionSuggestions: {
hereAlternateText: 'Iedereen in dit gesprek op de hoogte stellen',
Expand Down
6 changes: 6 additions & 0 deletions src/languages/params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ type ReportArchiveReasonsInvoiceReceiverPolicyDeletedParams = {
policyName: string;
};

type HarvestCreatedExpenseReportParams = {
reportUrl: string;
reportName: string;
};

type DuplicateTransactionParams = {
isSubmitted: boolean;
};
Expand Down Expand Up @@ -1110,6 +1115,7 @@ export type {
ReportArchiveReasonsMergedParams,
ReportPolicyNameParams,
ReportArchiveReasonsInvoiceReceiverPolicyDeletedParams,
HarvestCreatedExpenseReportParams,
ReportArchiveReasonsRemovedFromPolicyParams,
RequestAmountParams,
RequestCountParams,
Expand Down
3 changes: 3 additions & 0 deletions src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ import type {
FocusModeUpdateParams,
FormattedMaxLengthParams,
GoBackMessageParams,
HarvestCreatedExpenseReportParams,
ImportedTagsMessageParams,
ImportedTypesParams,
ImportFieldParams,
Expand Down Expand Up @@ -1014,6 +1015,8 @@ const translations: TranslationDeepObject<typeof en> = {
adminOnlyCanPost: 'Tylko administratorzy mogą wysyłać wiadomości w tym pokoju.',
reportAction: {
asCopilot: 'jako kopilot dla',
harvestCreatedExpenseReport: ({reportUrl, reportName}: HarvestCreatedExpenseReportParams) =>
`utworzył ten raport, aby zawrzeć wszystkie wydatki z <a href="${reportUrl}">${reportName}</a>, które nie mogły zostać przesłane zgodnie z wybraną przez ciebie częstotliwością`,
},
mentionSuggestions: {
hereAlternateText: 'Powiadom wszystkich w tej konwersacji',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ import type {
FocusModeUpdateParams,
FormattedMaxLengthParams,
GoBackMessageParams,
HarvestCreatedExpenseReportParams,
ImportedTagsMessageParams,
ImportedTypesParams,
ImportFieldParams,
Expand Down Expand Up @@ -1013,6 +1014,8 @@ const translations: TranslationDeepObject<typeof en> = {
adminOnlyCanPost: 'Somente administradores podem enviar mensagens nesta sala.',
reportAction: {
asCopilot: 'como copiloto para',
harvestCreatedExpenseReport: ({reportUrl, reportName}: HarvestCreatedExpenseReportParams) =>
`criou este relatório para agrupar todas as despesas de <a href="${reportUrl}">${reportName}</a> que não puderam ser enviadas na frequência que você escolheu`,
},
mentionSuggestions: {
hereAlternateText: 'Notificar todos nesta conversa',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/zh-hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ import type {
FocusModeUpdateParams,
FormattedMaxLengthParams,
GoBackMessageParams,
HarvestCreatedExpenseReportParams,
ImportedTagsMessageParams,
ImportedTypesParams,
ImportFieldParams,
Expand Down Expand Up @@ -1006,6 +1007,8 @@ const translations: TranslationDeepObject<typeof en> = {
adminOnlyCanPost: '只有管理员可以在此房间发送消息。',
reportAction: {
asCopilot: '作为副驾驶用于',
harvestCreatedExpenseReport: ({reportUrl, reportName}: HarvestCreatedExpenseReportParams) =>
`创建了此报表以汇总 <a href="${reportUrl}">${reportName}</a> 中无法按您选择的频率提交的所有费用`,
},
mentionSuggestions: {
hereAlternateText: '通知此对话中的所有人',
Expand Down
4 changes: 4 additions & 0 deletions src/libs/DebugUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,8 @@ function validateReportDraftProperty(key: keyof Report | keyof ReportNameValuePa
case 'preexistingReportID':
case 'private_isArchived':
case 'welcomeMessage':
case 'origin':
case 'originalID':
return validateString(value);
case 'hasOutstandingChildRequest':
case 'hasOutstandingChildTask':
Expand Down Expand Up @@ -641,6 +643,8 @@ function validateReportDraftProperty(key: keyof Report | keyof ReportNameValuePa
expensify_text_title: CONST.RED_BRICK_ROAD_PENDING_ACTION,
created: CONST.RED_BRICK_ROAD_PENDING_ACTION,
transactionCount: CONST.RED_BRICK_ROAD_PENDING_ACTION,
origin: CONST.RED_BRICK_ROAD_PENDING_ACTION,
originalID: CONST.RED_BRICK_ROAD_PENDING_ACTION,
});
case 'expensify_text_title':
return validateObject<ObjectElement<ReportNameValuePairs, 'expensify_text_title'>>(value, {
Expand Down
7 changes: 5 additions & 2 deletions src/libs/MoneyRequestReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,16 @@ const IOU_ACTIONS_TO_FILTER_OUT = new Set<OriginalMessageIOU['type']>([CONST.IOU
* at the top the report, instead of in-between the rest of messages like in normal chat.
* Because of that several action types are not relevant to this ReportView and should not be shown.
*/
function isActionVisibleOnMoneyRequestReport(action: ReportAction) {
function isActionVisibleOnMoneyRequestReport(action: ReportAction, shouldShowCreatedActions = false) {
if (isMoneyRequestAction(action)) {
const originalMessage = getOriginalMessage(action);
return originalMessage ? !IOU_ACTIONS_TO_FILTER_OUT.has(originalMessage.type) : false;
}
if (action.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED) {
return shouldShowCreatedActions;
}

return action.actionName !== CONST.REPORT.ACTIONS.TYPE.CREATED;
return true;
}

/**
Expand Down
62 changes: 62 additions & 0 deletions src/libs/Navigation/helpers/getReportURLForCurrentContext.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import {getEnvironmentURL} from '@libs/Environment/Environment';
import Navigation from '@libs/Navigation/Navigation';
import ROUTES from '@src/ROUTES';
import isSearchTopmostFullScreenRoute from './isSearchTopmostFullScreenRoute';

let environmentURL: string;
getEnvironmentURL().then((url: string) => (environmentURL = url));

/**
* Generates a URL for a report that respects the current navigation context.
* When in a search context, includes backTo parameter to preserve search state.
* Otherwise, returns a simple report URL.
*/
function getReportURLForCurrentContext(reportID: string | undefined): string {
if (!reportID) {
return `${environmentURL}/r/`;
}
const isInSearchContext = isSearchTopmostFullScreenRoute();
if (!isInSearchContext) {
return `${environmentURL}/${ROUTES.REPORT_WITH_ID.getRoute(reportID)}`;
}

// Navigation can return routes with a leading slash or missing when still mounting.
// Normalize everything to match the path shape used by ROUTES helpers.
const normalizeRoute = (route?: string) => {
if (!route) {
return undefined;
}
return route.startsWith('/') ? route.substring(1) : route;
};

const activeRoute = normalizeRoute(Navigation.getActiveRoute());

let backToRoute: string | undefined;

if (activeRoute) {
const [, queryString = ''] = activeRoute.split('?');
if (queryString) {
const params = new URLSearchParams(queryString);
const encodedBackTo = params.get('backTo');
if (encodedBackTo) {
// Prefer the backTo param when present; it points to the exact search state we left.
backToRoute = normalizeRoute(decodeURIComponent(encodedBackTo));
}
}

if (!backToRoute && activeRoute.startsWith(ROUTES.SEARCH_ROOT.route)) {
// Otherwise keep the current search route (preserves tab + filters) as the return target.
backToRoute = activeRoute;
}
}

if (!backToRoute?.startsWith(ROUTES.SEARCH_ROOT.route)) {
// Fall back to the generic search home when we can't recover a valid route.
backToRoute = ROUTES.SEARCH_ROOT.route;
}

const relativePath = ROUTES.SEARCH_MONEY_REQUEST_REPORT.getRoute({reportID, backTo: backToRoute});
return `${environmentURL}/${relativePath}`;
}

export default getReportURLForCurrentContext;
9 changes: 8 additions & 1 deletion src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import type {NullishDeep, OnyxCollection, OnyxEntry, OnyxUpdate} from 'react-native-onyx';
import Onyx from 'react-native-onyx';
import type {ValueOf} from 'type-fest';
import type {LocaleContextProps} from '@components/LocaleContextProvider';
import type {LocaleContextProps, LocalizedTranslate} from '@components/LocaleContextProvider';
import usePrevious from '@hooks/usePrevious';
import CONST from '@src/CONST';
import IntlStore from '@src/languages/IntlStore';
Expand All @@ -32,6 +32,7 @@
import {formatMessageElementList, translateLocal} from './Localize';
import Log from './Log';
import type {MessageElementBase, MessageTextElement} from './MessageElement';
import getReportURLForCurrentContext from './Navigation/helpers/getReportURLForCurrentContext';
import Parser from './Parser';
import {arePersonalDetailsMissing, getEffectiveDisplayName, getPersonalDetailByEmail, getPersonalDetailsByIDs} from './PersonalDetailsUtils';
import {getPolicy, isPolicyAdmin as isPolicyAdminPolicyUtils} from './PolicyUtils';
Expand All @@ -58,7 +59,7 @@
type MemberChangeMessageElement = MessageTextElement | MemberChangeMessageUserMentionElement | MemberChangeMessageRoomReferenceElement;

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

Check warning on line 62 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 @@ -70,7 +71,7 @@
});

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

Check warning on line 74 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 @@ -79,14 +80,14 @@
});

let isNetworkOffline = false;
Onyx.connect({

Check warning on line 83 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 currentUserAccountID: number | undefined;
let currentEmail = '';
Onyx.connect({

Check warning on line 90 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 @@ -3303,6 +3304,11 @@
return translateLocal('iou.changeApprover.changedApproverMessage', {managerID: actorAccountID});
}

function getHarvestCreatedExpenseReportMessage(reportID: string | undefined, reportName: string, translate: LocalizedTranslate) {
const reportUrl = getReportURLForCurrentContext(reportID);
return translate('reportAction.harvestCreatedExpenseReport', {reportUrl, reportName});
}

function isCardIssuedAction(
reportAction: OnyxEntry<ReportAction>,
): reportAction is ReportAction<
Expand Down Expand Up @@ -3699,6 +3705,7 @@
isPendingHide,
filterOutDeprecatedReportActions,
getActionableCardFraudAlertMessage,
getHarvestCreatedExpenseReportMessage,
isSystemUserMentioned,
};

Expand Down
Loading
Loading