Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
e98112b
Add CREATEDREPORTFORUNAPPROVEDTRANSACTIONS message support
hoangzinh Dec 22, 2025
1bbd178
Add CREATEDREPORTFORUNAPPROVEDTRANSACTIONS constant and handler function
hoangzinh Dec 22, 2025
4bea7d8
Add OriginalMessage type and fix TypeScript errors
hoangzinh Dec 22, 2025
7b62e22
Add CREATEDREPORTFORUNAPPROVEDTRANSACTIONS support in getReportName
hoangzinh Dec 22, 2025
e4d363e
Optimistically create the new system message linking to the original …
hoangzinh Dec 24, 2025
0559212
Merge branch 'main' into 74577-createdreportforunapprovedtransactions…
hoangzinh Dec 24, 2025
93ebb7a
Rename CONST.REPORT.ACTIONS.TYPE.CREATEDREPORTFORUNAPPROVEDTRANSACTIO…
hoangzinh Dec 24, 2025
17db23a
Fix spell check
hoangzinh Dec 24, 2025
d40c3f0
fix linter
hoangzinh Dec 24, 2025
8c4ae37
Correct request param optimisticCreatedReportForUnapprovedTransaction…
hoangzinh Dec 24, 2025
d35ecea
Merge branch 'main' into 74577-createdreportforunapprovedtransactions…
hoangzinh Dec 29, 2025
60f6713
Add comprehensive test coverage for CREATED_REPORT_FOR_UNAPPROVED_TRA…
hoangzinh Dec 29, 2025
00a9101
Add specs for render createdReportForUnapprovedTransactions
hoangzinh Dec 29, 2025
a60b4cd
Add translations for CREATED_REPORT_FOR_UNAPPROVED_TRANSACTIONS
hoangzinh Dec 29, 2025
34e066d
tests: use type-only import for KeyValueMapping in HeaderViewTest
hoangzinh Dec 30, 2025
a54536e
Add tests for CREATED_REPORT_FOR_UNAPPROVED_TRANSACTIONS (staged)
hoangzinh Dec 30, 2025
2b152ea
reportActionsUtils: narrow builder return type; tests: remove unsafe …
hoangzinh Dec 30, 2025
692884b
tests: type OriginalMessage in ReportActionsUtilsTest to access origi…
hoangzinh Dec 30, 2025
8655fff
tests: suppress eslint unsafe warnings for typed originalMessage access
hoangzinh Dec 30, 2025
e4cd3b4
Merge branch 'main' into 74577-createdreportforunapprovedtransactions…
hoangzinh Dec 31, 2025
041ea61
Merge branch 'main' into 74577-createdreportforunapprovedtransactions…
hoangzinh Jan 5, 2026
b7e5ea3
Fix originalReport is already declared in the upper scope
hoangzinh Jan 5, 2026
73cf60c
Merge branch 'main' into 74577-createdreportforunapprovedtransactions…
hoangzinh Jan 7, 2026
5275fe0
docs: document optimisticCreatedReportForUnapprovedTransactionsAction…
hoangzinh Jan 7, 2026
a2a05b4
Use setClipboardMessage
hoangzinh Jan 7, 2026
26d5a40
Should only use reportID of iouReport
hoangzinh Jan 7, 2026
f541d57
Move buildOptimisticCreatedReportForUnapprovedAction from ReportActio…
hoangzinh Jan 7, 2026
3d93827
Add comment for disable rule
hoangzinh Jan 7, 2026
5897491
Address reviewer feedback
hoangzinh Jan 8, 2026
e7e030d
Revert "Address reviewer feedback"
hoangzinh Jan 8, 2026
d852c7d
Add comment
hoangzinh Jan 8, 2026
edeccd4
Merge branch 'main' into 74577-createdreportforunapprovedtransactions…
hoangzinh Jan 9, 2026
5dde21f
refactor: convert getReportFromHoldRequestsOnyxData to use keyword ar…
hoangzinh Jan 9, 2026
f66d87e
refactor: add isApprovalFlow flag to conditionally create unapproved …
hoangzinh Jan 9, 2026
26a038c
chore: fix prettier formatting in es.ts
hoangzinh Jan 9, 2026
8bde79a
Merge branch 'main' into 74577-createdreportforunapprovedtransactions…
hoangzinh Jan 9, 2026
8f628e6
Run prettier
hoangzinh Jan 9, 2026
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
1 change: 1 addition & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1225,6 +1225,7 @@ const CONST = {
CARD_ASSIGNED: 'CARDASSIGNED',
CHANGE_FIELD: 'CHANGEFIELD', // OldDot Action
CHANGE_POLICY: 'CHANGEPOLICY',
CREATED_REPORT_FOR_UNAPPROVED_TRANSACTIONS: 'CREATEDREPORTFORUNAPPROVEDTRANSACTIONS',
CHANGE_TYPE: 'CHANGETYPE', // OldDot Action
CHRONOS_OOO_LIST: 'CHRONOSOOOLIST',
CLOSED: 'CLOSED',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import type en from './en';
import type {
ChangeFieldParams,
ConnectionNameParams,
CreatedReportForUnapprovedTransactionsParams,
DelegateRoleParams,
DeleteActionParams,
DeleteConfirmationParams,
Expand Down Expand Up @@ -920,6 +921,8 @@ const translations: TranslationDeepObject<typeof en> = {
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`,
createdReportForUnapprovedTransactions: ({reportUrl, reportName}: CreatedReportForUnapprovedTransactionsParams) =>
`hat diesen Bericht für alle zurückgehaltenen Ausgaben aus <a href="${reportUrl}">${reportName}</a> erstellt`,
},
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 @@ -9,6 +9,7 @@ import type OriginalMessage from '@src/types/onyx/OriginalMessage';
import type {
ChangeFieldParams,
ConnectionNameParams,
CreatedReportForUnapprovedTransactionsParams,
DelegateRoleParams,
DeleteActionParams,
DeleteConfirmationParams,
Expand Down Expand Up @@ -904,6 +905,8 @@ const translations = {
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`,
createdReportForUnapprovedTransactions: ({reportUrl, reportName}: CreatedReportForUnapprovedTransactionsParams) =>
`created this report for any held expenses from <a href="${reportUrl}">${reportName}</a>`,
},
mentionSuggestions: {
hereAlternateText: 'Notify everyone in this conversation',
Expand Down
11 changes: 10 additions & 1 deletion src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ 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 {HarvestCreatedExpenseReportParams, PaidElsewhereParams, RoutedDueToDEWParams, SplitDateRangeParams, ViolationsRterParams} from './params';
import type {
CreatedReportForUnapprovedTransactionsParams,
HarvestCreatedExpenseReportParams,
PaidElsewhereParams,
RoutedDueToDEWParams,
SplitDateRangeParams,
ViolationsRterParams,
} from './params';
import type {TranslationDeepObject} from './types';

/* eslint-disable max-len */
Expand Down Expand Up @@ -632,6 +639,8 @@ const translations: TranslationDeepObject<typeof en> = {
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`,
createdReportForUnapprovedTransactions: ({reportUrl, reportName}: CreatedReportForUnapprovedTransactionsParams) =>
`creó este informe para cualquier gasto retenido de <a href="${reportUrl}">${reportName}</a>`,
},
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 @@ -21,6 +21,7 @@ import type en from './en';
import type {
ChangeFieldParams,
ConnectionNameParams,
CreatedReportForUnapprovedTransactionsParams,
DelegateRoleParams,
DeleteActionParams,
DeleteConfirmationParams,
Expand Down Expand Up @@ -923,6 +924,8 @@ const translations: TranslationDeepObject<typeof en> = {
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`,
createdReportForUnapprovedTransactions: ({reportUrl, reportName}: CreatedReportForUnapprovedTransactionsParams) =>
`a créé ce rapport pour toutes les dépenses en attente depuis <a href="${reportUrl}">${reportName}</a>`,
},
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 @@ -21,6 +21,7 @@ import type en from './en';
import type {
ChangeFieldParams,
ConnectionNameParams,
CreatedReportForUnapprovedTransactionsParams,
DelegateRoleParams,
DeleteActionParams,
DeleteConfirmationParams,
Expand Down Expand Up @@ -920,6 +921,8 @@ const translations: TranslationDeepObject<typeof en> = {
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`,
createdReportForUnapprovedTransactions: ({reportUrl, reportName}: CreatedReportForUnapprovedTransactionsParams) =>
`ha creato questo report per eventuali spese in sospeso da <a href="${reportUrl}">${reportName}</a>`,
},
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 @@ -21,6 +21,7 @@ import type en from './en';
import type {
ChangeFieldParams,
ConnectionNameParams,
CreatedReportForUnapprovedTransactionsParams,
DelegateRoleParams,
DeleteActionParams,
DeleteConfirmationParams,
Expand Down Expand Up @@ -918,6 +919,8 @@ const translations: TranslationDeepObject<typeof en> = {
asCopilot: 'のコパイロットとして',
harvestCreatedExpenseReport: ({reportUrl, reportName}: HarvestCreatedExpenseReportParams) =>
`選択した頻度では提出できなかった <a href="${reportUrl}">${reportName}</a> のすべての経費をまとめるためにこのレポートを作成しました`,
createdReportForUnapprovedTransactions: ({reportUrl, reportName}: CreatedReportForUnapprovedTransactionsParams) =>
`<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 @@ -21,6 +21,7 @@ import type en from './en';
import type {
ChangeFieldParams,
ConnectionNameParams,
CreatedReportForUnapprovedTransactionsParams,
DelegateRoleParams,
DeleteActionParams,
DeleteConfirmationParams,
Expand Down Expand Up @@ -920,6 +921,8 @@ const translations: TranslationDeepObject<typeof en> = {
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`,
createdReportForUnapprovedTransactions: ({reportUrl, reportName}: CreatedReportForUnapprovedTransactionsParams) =>
`heeft dit rapport gemaakt voor uitgestelde uitgaven van <a href="${reportUrl}">${reportName}</a>`,
},
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 @@ -84,6 +84,11 @@ type HarvestCreatedExpenseReportParams = {
reportName: string;
};

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

type MovedTransactionParams = {
reportUrl: string;
reportName?: string;
Expand Down Expand Up @@ -777,6 +782,7 @@ export type {
ReportPolicyNameParams,
ReportArchiveReasonsInvoiceReceiverPolicyDeletedParams,
HarvestCreatedExpenseReportParams,
CreatedReportForUnapprovedTransactionsParams,
ReportArchiveReasonsRemovedFromPolicyParams,
RequestAmountParams,
MovedTransactionParams,
Expand Down
3 changes: 3 additions & 0 deletions src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import type en from './en';
import type {
ChangeFieldParams,
ConnectionNameParams,
CreatedReportForUnapprovedTransactionsParams,
DelegateRoleParams,
DeleteActionParams,
DeleteConfirmationParams,
Expand Down Expand Up @@ -919,6 +920,8 @@ const translations: TranslationDeepObject<typeof en> = {
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ą`,
createdReportForUnapprovedTransactions: ({reportUrl, reportName}: CreatedReportForUnapprovedTransactionsParams) =>
`utworzył ten raport dla wszystkich wstrzymanych wydatków z <a href="${reportUrl}">${reportName}</a>`,
},
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 @@ -21,6 +21,7 @@ import type en from './en';
import type {
ChangeFieldParams,
ConnectionNameParams,
CreatedReportForUnapprovedTransactionsParams,
DelegateRoleParams,
DeleteActionParams,
DeleteConfirmationParams,
Expand Down Expand Up @@ -919,6 +920,8 @@ const translations: TranslationDeepObject<typeof en> = {
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`,
createdReportForUnapprovedTransactions: ({reportUrl, reportName}: CreatedReportForUnapprovedTransactionsParams) =>
`criou este relatório para quaisquer despesas retidas de <a href="${reportUrl}">${reportName}</a>`,
},
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 @@ -21,6 +21,7 @@ import type en from './en';
import type {
ChangeFieldParams,
ConnectionNameParams,
CreatedReportForUnapprovedTransactionsParams,
DelegateRoleParams,
DeleteActionParams,
DeleteConfirmationParams,
Expand Down Expand Up @@ -911,6 +912,8 @@ const translations: TranslationDeepObject<typeof en> = {
asCopilot: '作为副驾驶用于',
harvestCreatedExpenseReport: ({reportUrl, reportName}: HarvestCreatedExpenseReportParams) =>
`创建了此报表以汇总 <a href="${reportUrl}">${reportName}</a> 中无法按您选择的频率提交的所有费用`,
createdReportForUnapprovedTransactions: ({reportUrl, reportName}: CreatedReportForUnapprovedTransactionsParams) =>
`为来自 <a href="${reportUrl}">${reportName}</a> 的所有暂挂报销创建了此报表`,
},
mentionSuggestions: {
hereAlternateText: '通知此对话中的所有人',
Expand Down
3 changes: 3 additions & 0 deletions src/libs/API/parameters/ApproveMoneyRequestParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ type ApproveMoneyRequestParams = {
* }>
*/
optimisticHoldReportExpenseActionIDs?: string;

/** The optimistic action ID for the report created for unapproved transactions */
optimisticCreatedReportForUnapprovedTransactionsActionID?: string;
};

export default ApproveMoneyRequestParams;
11 changes: 10 additions & 1 deletion src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import type {ValueOf} from 'type-fest';
import type {LocaleContextProps, LocalizedTranslate} from '@components/LocaleContextProvider';
import usePrevious from '@hooks/usePrevious';
import {isHarvestCreatedExpenseReport, isPolicyExpenseChat} from '@libs/ReportUtils';

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

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Unexpected subpath import via alias '@libs/ReportUtils'. Use './ReportUtils' instead
import CONST from '@src/CONST';
import IntlStore from '@src/languages/IntlStore';
import type {TranslationPaths} from '@src/languages/types';
Expand Down Expand Up @@ -66,7 +66,7 @@
type MemberChangeMessageElement = MessageTextElement | MemberChangeMessageUserMentionElement | MemberChangeMessageRoomReferenceElement;

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

Check warning on line 69 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 @@ -78,7 +78,7 @@
});

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

Check warning on line 81 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 @@ -87,13 +87,13 @@
});

let isNetworkOffline = false;
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.NETWORK,
callback: (val) => (isNetworkOffline = val?.isOffline ?? false),
});

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

Check warning on line 96 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 @@ -170,7 +170,10 @@
}

// for report actions with this type we get an empty array as message by design
if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_DIRECTOR_INFORMATION_REQUIRED) {
if (
reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_DIRECTOR_INFORMATION_REQUIRED ||
reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED_REPORT_FOR_UNAPPROVED_TRANSACTIONS
) {
return false;
}

Expand Down Expand Up @@ -3314,6 +3317,11 @@
return translate('reportAction.harvestCreatedExpenseReport', {reportUrl, reportName});
}

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

function getDynamicExternalWorkflowRoutedMessage(
action: OnyxEntry<ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.DYNAMIC_EXTERNAL_WORKFLOW_ROUTED>>,
translate: LocaleContextProps['translate'],
Expand Down Expand Up @@ -3728,6 +3736,7 @@
filterOutDeprecatedReportActions,
getActionableCardFraudAlertMessage,
getHarvestCreatedExpenseReportMessage,
getCreatedReportForUnapprovedTransactionsMessage,
isSystemUserMentioned,
withDEWRoutedActionsArray,
withDEWRoutedActionsObject,
Expand Down
45 changes: 45 additions & 0 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ import {
getCardIssuedMessage,
getChangedApproverActionMessage,
getCompanyCardConnectionBrokenMessage,
getCreatedReportForUnapprovedTransactionsMessage,
getDefaultApproverUpdateMessage,
getDismissedViolationMessageText,
getExportIntegrationLastMessageText,
Expand Down Expand Up @@ -5853,6 +5854,14 @@ function getReportName(
// eslint-disable-next-line @typescript-eslint/no-deprecated
return getWorkspaceCustomUnitRateDeletedMessage(translateLocal, parentReportAction);
}
if (isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.CREATED_REPORT_FOR_UNAPPROVED_TRANSACTIONS)) {
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);
// eslint-disable-next-line @typescript-eslint/no-deprecated -- temporarily disabling rule for deprecated functions out of issue scope
return getCreatedReportForUnapprovedTransactionsMessage(originalID, reportName, translateLocal);
}
Comment on lines +5857 to +5864
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What i did:

  1. modified this if to
Suggested change
if (isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.CREATED_REPORT_FOR_UNAPPROVED_TRANSACTIONS)) {
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);
// eslint-disable-next-line @typescript-eslint/no-deprecated -- temporarily disabling rule for deprecated functions out of issue scope
return getCreatedReportForUnapprovedTransactionsMessage(originalID, reportName, translateLocal);
}
if (isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.CREATED_REPORT_FOR_UNAPPROVED_TRANSACTIONS)) {
console.log('SHOW THIS LOG')
return 'Early return to test this'
}
  1. followed test steps from QA

And this code was never executed and name of mentioned action was still correct. Is this code really needed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@sosek108 It's the report thread name. If you're refactoring it, it will be covered by this test

it('should display correct title for report with CREATED_REPORT_FOR_UNAPPROVED_TRANSACTIONS parent action', async () => {
// Given a chat thread with a CREATED_REPORT_FOR_UNAPPROVED_TRANSACTIONS parent action

Screen.Recording.2026-02-26.at.16.34.33.mov

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for confirming


if (isChatThread(report)) {
if (!isEmptyObject(parentReportAction) && isTransactionThread(parentReportAction)) {
Expand Down Expand Up @@ -7258,6 +7267,41 @@ function buildOptimisticUnapprovedReportAction(amount: number, currency: string,
};
}

/**
* Builds an optimistic CREATED_REPORT_FOR_UNAPPROVED_TRANSACTIONS system report action.
* Used to inform users that a new report was created for held/unapproved transactions.
*/
function buildOptimisticCreatedReportForUnapprovedAction(
reportID: string,
originalReportID: string | undefined,
): ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.CREATED_REPORT_FOR_UNAPPROVED_TRANSACTIONS> {
const createdTime = DateUtils.getDBTime();
const actor = getAccountIDsByLogins([CONST.EMAIL.CONCIERGE]).at(0);

return {
actionName: CONST.REPORT.ACTIONS.TYPE.CREATED_REPORT_FOR_UNAPPROVED_TRANSACTIONS,
actorAccountID: actor,
avatar: getDefaultAvatarURL({accountID: actor, accountEmail: CONST.EMAIL.CONCIERGE}),
created: createdTime,
lastModified: createdTime,
message: [],
originalMessage: {
originalID: originalReportID,
},
reportActionID: rand64(),
reportID,
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
isOptimisticAction: true,
shouldShow: true,
person: [
{
text: CONST.DISPLAY_NAME.EXPENSIFY_CONCIERGE,
type: 'TEXT',
},
],
};
}

/**
* Builds an optimistic MOVED report action with a randomly generated reportActionID.
* This action is used when we move reports across workspaces.
Expand Down Expand Up @@ -12809,6 +12853,7 @@ export {
buildOptimisticAddCommentReportAction,
buildOptimisticApprovedReportAction,
checkBulkRejectHydration,
buildOptimisticCreatedReportForUnapprovedAction,
buildOptimisticUnapprovedReportAction,
buildOptimisticCancelPaymentReportAction,
buildOptimisticChangedTaskAssigneeReportAction,
Expand Down
Loading
Loading