diff --git a/Mobile-Expensify b/Mobile-Expensify
index 0f921a2cd1e6..f2d39597cfc9 160000
--- a/Mobile-Expensify
+++ b/Mobile-Expensify
@@ -1 +1 @@
-Subproject commit 0f921a2cd1e685ff7137ea1e6815cf1cb218b3b6
+Subproject commit f2d39597cfc9e2ac5565aa103dcd5ec4635c4005
diff --git a/android/app/build.gradle b/android/app/build.gradle
index 15c0feb4c139..67bd4f5276a1 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -114,8 +114,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
- versionCode 1009018105
- versionName "9.1.81-5"
+ versionCode 1009018106
+ versionName "9.1.81-6"
// Supported language variants must be declared here to avoid from being removed during the compilation.
// This also helps us to not include unnecessary language variants in the APK.
resConfigs "en", "es"
diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist
index ee338e56ca8f..3fbae028a7f8 100644
--- a/ios/NewExpensify/Info.plist
+++ b/ios/NewExpensify/Info.plist
@@ -44,7 +44,7 @@
CFBundleVersion
- 9.1.81.5
+ 9.1.81.6
FullStory
OrgId
diff --git a/ios/NotificationServiceExtension/Info.plist b/ios/NotificationServiceExtension/Info.plist
index 34b685b16188..ed00955e109d 100644
--- a/ios/NotificationServiceExtension/Info.plist
+++ b/ios/NotificationServiceExtension/Info.plist
@@ -13,7 +13,7 @@
CFBundleShortVersionString
9.1.81
CFBundleVersion
- 9.1.81.5
+ 9.1.81.6
NSExtension
NSExtensionPointIdentifier
diff --git a/ios/ShareViewController/Info.plist b/ios/ShareViewController/Info.plist
index 5acf0c7b0021..a09bf22eac78 100644
--- a/ios/ShareViewController/Info.plist
+++ b/ios/ShareViewController/Info.plist
@@ -13,7 +13,7 @@
CFBundleShortVersionString
9.1.81
CFBundleVersion
- 9.1.81.5
+ 9.1.81.6
NSExtension
NSExtensionAttributes
diff --git a/package-lock.json b/package-lock.json
index 1f34bdb97a81..cb7fa8697a7c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "new.expensify",
- "version": "9.1.81-5",
+ "version": "9.1.81-6",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "new.expensify",
- "version": "9.1.81-5",
+ "version": "9.1.81-6",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
diff --git a/package.json b/package.json
index 2efcad997b7b..d6a474b9ae97 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
- "version": "9.1.81-5",
+ "version": "9.1.81-6",
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
diff --git a/src/components/MoneyReportHeader.tsx b/src/components/MoneyReportHeader.tsx
index ca1d7717f3bb..a29e8e5ac757 100644
--- a/src/components/MoneyReportHeader.tsx
+++ b/src/components/MoneyReportHeader.tsx
@@ -312,7 +312,7 @@ function MoneyReportHeader({
const isSubmitterSameAsNextApprover = isReportOwner(moneyRequestReport) && nextApproverAccountID === moneyRequestReport?.ownerAccountID;
const optimisticNextStep = isSubmitterSameAsNextApprover && policy?.preventSelfApproval ? buildOptimisticNextStepForPreventSelfApprovalsEnabled() : nextStep;
- const shouldShowNextStep = isFromPaidPolicy && !isInvoiceReport && !shouldShowStatusBar && transactions.length > 0;
+ const shouldShowNextStep = isFromPaidPolicy && !isInvoiceReport && !shouldShowStatusBar;
const bankAccountRoute = getBankAccountRoute(chatReport);
const {nonHeldAmount, fullAmount, hasValidNonHeldAmount} = getNonHeldAndFullAmount(moneyRequestReport, shouldShowPayButton);
const isAnyTransactionOnHold = hasHeldExpensesReportUtils(moneyRequestReport?.reportID);
diff --git a/src/components/TransactionItemRow/DataCells/ChatBubbleCell.tsx b/src/components/TransactionItemRow/DataCells/ChatBubbleCell.tsx
index 3e503eb2afa3..cee24c97d691 100644
--- a/src/components/TransactionItemRow/DataCells/ChatBubbleCell.tsx
+++ b/src/components/TransactionItemRow/DataCells/ChatBubbleCell.tsx
@@ -9,7 +9,6 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useStyleUtils from '@hooks/useStyleUtils';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
-import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID';
import {getIOUActionForTransactionID} from '@libs/ReportActionsUtils';
import {isChatThread} from '@libs/ReportUtils';
import variables from '@styles/variables';
@@ -24,9 +23,7 @@ function ChatBubbleCell({transaction, containerStyles, isInSingleTransactionRepo
const theme = useTheme();
const styles = useThemeStyles();
const {shouldUseNarrowLayout} = useResponsiveLayout();
- const nonEmptyStringTransactionReportID = getNonEmptyStringOnyxID(transaction.reportID);
-
- const [iouReportAction] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${nonEmptyStringTransactionReportID}`, {
+ const [iouReportAction] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transaction.reportID}`, {
selector: (reportActions) => getIOUActionForTransactionID(Object.values(reportActions ?? {}), transaction.transactionID),
canBeMissing: true,
});
@@ -35,7 +32,7 @@ function ChatBubbleCell({transaction, containerStyles, isInSingleTransactionRepo
canBeMissing: true,
});
- const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${nonEmptyStringTransactionReportID}`, {
+ const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${transaction.reportID}`, {
canBeMissing: false,
});
diff --git a/src/languages/de.ts b/src/languages/de.ts
index 13620fbb5754..35308f588dff 100644
--- a/src/languages/de.ts
+++ b/src/languages/de.ts
@@ -1070,8 +1070,6 @@ const translations = {
scanMultipleReceiptsDescription: 'Machen Sie Fotos von all Ihren Belegen auf einmal, dann bestätigen Sie die Details selbst oder lassen Sie SmartScan dies übernehmen.',
receiptScanInProgress: 'Belegscan läuft',
receiptScanInProgressDescription: 'Belegscan läuft. Später erneut prüfen oder die Details jetzt eingeben.',
- removeFromReport: 'Ausgabe aus Bericht entfernen',
- moveToPersonalSpace: 'Ausgaben in persönlichen Bereich verschieben',
duplicateTransaction: ({isSubmitted}: DuplicateTransactionParams) =>
!isSubmitted
? 'Mögliche doppelte Ausgaben erkannt. Überprüfen Sie die Duplikate, um die Einreichung zu ermöglichen.'
diff --git a/src/languages/en.ts b/src/languages/en.ts
index ed049e8e6db1..3d880cb9263d 100755
--- a/src/languages/en.ts
+++ b/src/languages/en.ts
@@ -1055,8 +1055,6 @@ const translations = {
scanMultipleReceiptsDescription: 'Snap photos of all your receipts at once, then confirm details yourself or let SmartScan handle it.',
receiptScanInProgress: 'Receipt scan in progress',
receiptScanInProgressDescription: 'Receipt scan in progress. Check back later or enter the details now.',
- removeFromReport: 'Remove from report',
- moveToPersonalSpace: 'Move expenses to your personal space',
duplicateTransaction: ({isSubmitted}: DuplicateTransactionParams) =>
!isSubmitted
? 'Potential duplicate expenses identified. Review duplicates to enable submission.'
diff --git a/src/languages/es.ts b/src/languages/es.ts
index 660f47963e3a..7906925d9854 100644
--- a/src/languages/es.ts
+++ b/src/languages/es.ts
@@ -1055,8 +1055,6 @@ const translations = {
scanMultipleReceiptsDescription: 'Tome fotos de todos sus recibos a la vez y confirme los detalles usted mismo o deje que SmartScan se encargue.',
receiptScanInProgress: 'Escaneado de recibo en proceso',
receiptScanInProgressDescription: 'Escaneado de recibo en proceso. Vuelve a comprobarlo más tarde o introduce los detalles ahora.',
- removeFromReport: 'Eliminar del informe',
- moveToPersonalSpace: 'Mover gastos a tu espacio personal',
duplicateTransaction: ({isSubmitted}: DuplicateTransactionParams) =>
!isSubmitted
? 'Se han identificado posibles gastos duplicados. Revisa los duplicados para habilitar el envío.'
diff --git a/src/languages/fr.ts b/src/languages/fr.ts
index c2c43f1c2d1f..96612d6d4c8f 100644
--- a/src/languages/fr.ts
+++ b/src/languages/fr.ts
@@ -1071,8 +1071,6 @@ const translations = {
scanMultipleReceiptsDescription: "Prenez des photos de tous vos reçus en une seule fois, puis confirmez les détails vous-même ou laissez SmartScan s'en charger.",
receiptScanInProgress: 'Numérisation du reçu en cours',
receiptScanInProgressDescription: 'Numérisation du reçu en cours. Revenez plus tard ou saisissez les détails maintenant.',
- removeFromReport: 'Supprimer du rapport',
- moveToPersonalSpace: 'Déplacer les dépenses vers votre espace personnel',
duplicateTransaction: ({isSubmitted}: DuplicateTransactionParams) =>
!isSubmitted
? 'Dépenses potentiellement en double identifiées. Vérifiez les doublons pour permettre la soumission.'
diff --git a/src/languages/it.ts b/src/languages/it.ts
index a93da7a2fa7d..53699b2ee04c 100644
--- a/src/languages/it.ts
+++ b/src/languages/it.ts
@@ -1066,8 +1066,6 @@ const translations = {
scanMultipleReceiptsDescription: 'Scatta foto di tutte le tue ricevute in una volta, poi conferma i dettagli tu stesso o lascia che SmartScan se ne occupi.',
receiptScanInProgress: 'Scansione della ricevuta in corso',
receiptScanInProgressDescription: 'Scansione della ricevuta in corso. Controlla più tardi o inserisci i dettagli ora.',
- removeFromReport: 'Rimuovi dal rapporto',
- moveToPersonalSpace: 'Sposta spese nello spazio personale',
duplicateTransaction: ({isSubmitted}: DuplicateTransactionParams) =>
!isSubmitted
? "Spese potenzialmente duplicate identificate. Rivedi i duplicati per consentire l'invio."
diff --git a/src/languages/ja.ts b/src/languages/ja.ts
index 8f63f29acb8b..c0c7fd35a7f5 100644
--- a/src/languages/ja.ts
+++ b/src/languages/ja.ts
@@ -1069,8 +1069,6 @@ const translations = {
scanMultipleReceiptsDescription: 'すべての領収書を一度に撮影し、自分で詳細を確認するか、SmartScanに任せましょう。',
receiptScanInProgress: '領収書のスキャン中',
receiptScanInProgressDescription: '領収書のスキャン中です。後で確認するか、今すぐ詳細を入力してください。',
- removeFromReport: '領収書を削除',
- moveToPersonalSpace: '領収書を個人スペースに移動',
duplicateTransaction: ({isSubmitted}: DuplicateTransactionParams) =>
!isSubmitted
? '重複の可能性がある経費が特定されました。提出を有効にするために重複を確認してください。'
diff --git a/src/languages/nl.ts b/src/languages/nl.ts
index 164ffed215c9..f178dffcdef3 100644
--- a/src/languages/nl.ts
+++ b/src/languages/nl.ts
@@ -1067,8 +1067,6 @@ const translations = {
scanMultipleReceiptsDescription: "Maak foto's van al je bonnetjes tegelijk, bevestig dan zelf de details of laat SmartScan het afhandelen.",
receiptScanInProgress: 'Bon scannen bezig',
receiptScanInProgressDescription: 'Bon scannen bezig. Kom later terug of voer de gegevens nu in.',
- removeFromReport: 'Verwijder uit rapport',
- moveToPersonalSpace: 'Verplaats uitgaven naar persoonlijke ruimte',
duplicateTransaction: ({isSubmitted}: DuplicateTransactionParams) =>
!isSubmitted
? 'Potentiële dubbele uitgaven geïdentificeerd. Controleer duplicaten om indiening mogelijk te maken.'
diff --git a/src/languages/pl.ts b/src/languages/pl.ts
index b59ff887699e..23b495dfd21a 100644
--- a/src/languages/pl.ts
+++ b/src/languages/pl.ts
@@ -1065,8 +1065,6 @@ const translations = {
scanMultipleReceiptsDescription: 'Zrób zdjęcia wszystkich swoich paragonów naraz, a następnie potwierdź szczegóły samodzielnie lub pozwól, aby SmartScan się tym zajął.',
receiptScanInProgress: 'Skanowanie paragonu w toku',
receiptScanInProgressDescription: 'Trwa skanowanie paragonu. Sprawdź później lub wprowadź dane teraz.',
- removeFromReport: 'Usuń z raportu',
- moveToPersonalSpace: 'Przenieś wydatek do przestrzeni osobistej',
duplicateTransaction: ({isSubmitted}: DuplicateTransactionParams) =>
!isSubmitted
? 'Zidentyfikowano potencjalne duplikaty wydatków. Przejrzyj duplikaty, aby umożliwić przesłanie.'
diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts
index 9587e255fe16..90fa56ee4f1e 100644
--- a/src/languages/pt-BR.ts
+++ b/src/languages/pt-BR.ts
@@ -1067,8 +1067,6 @@ const translations = {
scanMultipleReceiptsDescription: 'Tire fotos de todos os seus recibos de uma vez, depois confirme os detalhes você mesmo ou deixe o SmartScan cuidar disso.',
receiptScanInProgress: 'Digitalização de recibo em andamento',
receiptScanInProgressDescription: 'Digitalização do recibo em andamento. Verifique mais tarde ou insira os detalhes agora.',
- removeFromReport: 'Remover do relatório',
- moveToPersonalSpace: 'Mover despesas para o espaço pessoal',
duplicateTransaction: ({isSubmitted}: DuplicateTransactionParams) =>
!isSubmitted
? 'Despesas duplicadas potenciais identificadas. Revise as duplicatas para permitir o envio.'
diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts
index 11a7e8811e37..c1136bdde8ce 100644
--- a/src/languages/zh-hans.ts
+++ b/src/languages/zh-hans.ts
@@ -1060,8 +1060,6 @@ const translations = {
scanMultipleReceiptsDescription: '一次拍摄所有收据的照片,然后自行确认详细信息或让SmartScan处理。',
receiptScanInProgress: '正在扫描收据',
receiptScanInProgressDescription: '收据扫描中。稍后查看或立即输入详细信息。',
- removeFromReport: '不在此报告中',
- moveToPersonalSpace: '移动费用到个人空间',
duplicateTransaction: ({isSubmitted}: DuplicateTransactionParams) => (!isSubmitted ? '发现潜在的重复费用。请查看重复项以启用提交。' : '发现潜在的重复费用。请审查重复项以启用批准。'),
receiptIssuesFound: () => ({
one: '发现问题',
diff --git a/src/libs/API/parameters/ChangeTransactionsReportParams.ts b/src/libs/API/parameters/ChangeTransactionsReportParams.ts
index cffe407df170..05dfcdb496ab 100644
--- a/src/libs/API/parameters/ChangeTransactionsReportParams.ts
+++ b/src/libs/API/parameters/ChangeTransactionsReportParams.ts
@@ -8,8 +8,6 @@ type TransactionThreadInfo = {
moneyRequestPreviewReportActionID: string;
transactionThreadReportID?: string;
transactionThreadCreatedReportActionID?: string;
- selfDMReportID?: string;
- selfDMCreatedReportActionID?: string;
};
type ChangeTransactionsReportParams = {
diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts
index c612dafaee40..747aeb295243 100644
--- a/src/libs/ReportUtils.ts
+++ b/src/libs/ReportUtils.ts
@@ -4219,18 +4219,11 @@ function canEditFieldOfMoneyRequest(reportAction: OnyxInputOrEntry
}
if (fieldToEdit === CONST.EDIT_REQUEST_FIELD.REPORT) {
- const isRequestIOU = isIOUReport(moneyRequestReport);
- if (isRequestIOU) {
- return false;
- }
- const isOwner = moneyRequestReport?.ownerAccountID === currentUserAccountID;
-
// Unreported transaction from OldDot can have the reportID as an empty string
const isUnreported = !transaction?.reportID || transaction?.reportID === CONST.REPORT.UNREPORTED_REPORT_ID;
return isUnreported
? Object.values(allPolicies ?? {}).flatMap((currentPolicy) => getOutstandingReportsForUser(currentPolicy?.id, currentUserAccountID, allReports ?? {})).length > 0
- : Object.values(allPolicies ?? {}).flatMap((currentPolicy) => getOutstandingReportsForUser(currentPolicy?.id, moneyRequestReport?.ownerAccountID, allReports ?? {})).length > 1 ||
- isOwner;
+ : Object.values(allPolicies ?? {}).flatMap((currentPolicy) => getOutstandingReportsForUser(currentPolicy?.id, moneyRequestReport?.ownerAccountID, allReports ?? {})).length > 1;
}
return true;
diff --git a/src/libs/actions/Transaction.ts b/src/libs/actions/Transaction.ts
index 370dc82efcc6..a931e9b948d0 100644
--- a/src/libs/actions/Transaction.ts
+++ b/src/libs/actions/Transaction.ts
@@ -17,7 +17,6 @@ import {
buildOptimisticCreatedReportAction,
buildOptimisticDismissedViolationReportAction,
buildOptimisticMovedTransactionAction,
- buildOptimisticSelfDMReport,
buildOptimisticUnreportedTransactionAction,
buildTransactionThread,
findSelfDMReportID,
@@ -605,108 +604,25 @@ function setTransactionReport(transactionID: string, reportID: string, isDraft:
function changeTransactionsReport(transactionIDs: string[], reportID: string, policy?: OnyxEntry) {
const newReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`];
+ if (!newReport) {
+ return;
+ }
const transactions = transactionIDs.map((id) => allTransactions?.[id]).filter((t): t is NonNullable => t !== undefined);
const transactionIDToReportActionAndThreadData: Record = {};
const updatedReportTotals: Record = {};
- // Store current violations for each transaction to restore on failure
- const currentTransactionViolations: Record = {};
- transactionIDs.forEach((id) => {
- currentTransactionViolations[id] = allTransactionViolation?.[id] ?? [];
- });
-
const optimisticData: OnyxUpdate[] = [];
const failureData: OnyxUpdate[] = [];
const successData: OnyxUpdate[] = [];
- const existingSelfDMReportID = findSelfDMReportID();
- let selfDMReport: Report;
- let selfDMCreatedReportAction: ReportAction;
-
- if (!existingSelfDMReportID && reportID === CONST.REPORT.UNREPORTED_REPORT_ID) {
- const currentTime = DateUtils.getDBTime();
- selfDMReport = buildOptimisticSelfDMReport(currentTime);
- selfDMCreatedReportAction = buildOptimisticCreatedReportAction(currentUserEmail ?? '', currentTime);
-
- // Add optimistic updates for self DM report
- optimisticData.push(
- {
- onyxMethod: Onyx.METHOD.SET,
- key: `${ONYXKEYS.COLLECTION.REPORT}${selfDMReport.reportID}`,
- value: {
- ...selfDMReport,
- pendingFields: {
- createChat: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
- },
- },
- },
- {
- onyxMethod: Onyx.METHOD.MERGE,
- key: `${ONYXKEYS.COLLECTION.REPORT_METADATA}${selfDMReport.reportID}`,
- value: {isOptimisticReport: true},
- },
- {
- onyxMethod: Onyx.METHOD.SET,
- key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${selfDMReport.reportID}`,
- value: {
- [selfDMCreatedReportAction.reportActionID]: selfDMCreatedReportAction,
- },
- },
- );
-
- // Add success data for self DM report
- successData.push(
- {
- onyxMethod: Onyx.METHOD.MERGE,
- key: `${ONYXKEYS.COLLECTION.REPORT}${selfDMReport.reportID}`,
- value: {
- pendingFields: {
- createChat: null,
- },
- },
- },
- {
- onyxMethod: Onyx.METHOD.MERGE,
- key: `${ONYXKEYS.COLLECTION.REPORT_METADATA}${selfDMReport.reportID}`,
- value: {isOptimisticReport: false},
- },
- {
- onyxMethod: Onyx.METHOD.MERGE,
- key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${selfDMReport.reportID}`,
- value: {
- [selfDMCreatedReportAction.reportActionID]: {
- pendingAction: null,
- },
- },
- },
- );
- // Add failure data for self DM report
- failureData.push(
- {
- onyxMethod: Onyx.METHOD.MERGE,
- key: `${ONYXKEYS.COLLECTION.REPORT}${selfDMReport.reportID}`,
- value: null,
- },
- {
- onyxMethod: Onyx.METHOD.MERGE,
- key: `${ONYXKEYS.COLLECTION.REPORT_METADATA}${selfDMReport.reportID}`,
- value: null,
- },
- {
- onyxMethod: Onyx.METHOD.MERGE,
- key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${selfDMReport.reportID}`,
- value: null,
- },
- );
- }
-
let transactionsMoved = false;
transactions.forEach((transaction) => {
const isUnreported = !transaction.reportID || transaction.reportID === CONST.REPORT.UNREPORTED_REPORT_ID;
- const selfDMReportID = existingSelfDMReportID ?? selfDMReport.reportID;
+ // We'll handle optimistically creating the selfDM as part of https://github.com/Expensify/App/issues/60288
+ const selfDMReportID = findSelfDMReportID() ?? CONST.REPORT.UNREPORTED_REPORT_ID;
const oldIOUAction = getIOUActionForReportID(isUnreported ? selfDMReportID : transaction.reportID, transaction.transactionID);
if (!transaction.reportID || transaction.reportID === reportID) {
@@ -719,13 +635,11 @@ function changeTransactionsReport(transactionIDs: string[], reportID: string, po
const oldReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${oldReportID}`];
// 1. Optimistically change the reportID on the passed transactions
- const targetReportID = reportID === CONST.REPORT.UNREPORTED_REPORT_ID ? selfDMReportID : reportID;
-
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transaction.transactionID}`,
value: {
- reportID: targetReportID,
+ reportID,
},
});
@@ -733,7 +647,7 @@ function changeTransactionsReport(transactionIDs: string[], reportID: string, po
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transaction.transactionID}`,
value: {
- reportID: targetReportID,
+ reportID,
},
});
@@ -745,38 +659,6 @@ function changeTransactionsReport(transactionIDs: string[], reportID: string, po
},
});
- // Optimistically clear all violations for the transaction when moving to self DM report
- if (reportID === CONST.REPORT.UNREPORTED_REPORT_ID) {
- const duplicateViolation = currentTransactionViolations?.[transaction.transactionID]?.find((violation) => violation.name === CONST.VIOLATIONS.DUPLICATED_TRANSACTION);
- const duplicateTransactionIDs = duplicateViolation?.data?.duplicates;
- if (duplicateTransactionIDs) {
- duplicateTransactionIDs.forEach((id) => {
- optimisticData.push({
- onyxMethod: Onyx.METHOD.SET,
- key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${id}`,
- value: allTransactionViolations.filter((violation: TransactionViolation) => violation.name !== CONST.VIOLATIONS.DUPLICATED_TRANSACTION),
- });
- });
- }
- optimisticData.push({
- onyxMethod: Onyx.METHOD.SET,
- key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transaction.transactionID}`,
- value: null,
- });
-
- successData.push({
- onyxMethod: Onyx.METHOD.SET,
- key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transaction.transactionID}`,
- value: null,
- });
-
- failureData.push({
- onyxMethod: Onyx.METHOD.SET,
- key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transaction.transactionID}`,
- value: currentTransactionViolations[transaction.transactionID],
- });
- }
-
// 2. Calculate transaction violations if moving transaction to a workspace
if (isPaidGroupPolicy(policy) && policy?.id) {
const policyTagList = getPolicyTagsData(policy.id);
@@ -802,8 +684,8 @@ function changeTransactionsReport(transactionIDs: string[], reportID: string, po
if (oldReport) {
updatedReportTotals[oldReportID] = (updatedReportTotals[oldReportID] ? updatedReportTotals[oldReportID] : (oldReport?.total ?? 0)) + transactionAmount;
}
- if (reportID && newReport) {
- updatedReportTotals[targetReportID] = (updatedReportTotals[targetReportID] ? updatedReportTotals[targetReportID] : (newReport.total ?? 0)) - transactionAmount;
+ if (reportID) {
+ updatedReportTotals[reportID] = (updatedReportTotals[reportID] ? updatedReportTotals[reportID] : (newReport.total ?? 0)) - transactionAmount;
}
// 4. Optimistically update the IOU action reportID
@@ -822,7 +704,7 @@ function changeTransactionsReport(transactionIDs: string[], reportID: string, po
if (oldIOUAction) {
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
- key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${targetReportID}`,
+ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`,
value: {
[newIOUAction.reportActionID]: newIOUAction,
},
@@ -855,7 +737,7 @@ function changeTransactionsReport(transactionIDs: string[], reportID: string, po
successData.push({
onyxMethod: Onyx.METHOD.MERGE,
- key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${targetReportID}`,
+ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`,
value: {
[newIOUAction.reportActionID]: {pendingAction: null},
},
@@ -864,7 +746,7 @@ function changeTransactionsReport(transactionIDs: string[], reportID: string, po
failureData.push(
{
onyxMethod: Onyx.METHOD.MERGE,
- key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${targetReportID}`,
+ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`,
value: {
[newIOUAction.reportActionID]: null,
},
@@ -885,9 +767,9 @@ function changeTransactionsReport(transactionIDs: string[], reportID: string, po
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${newIOUAction.childReportID}`,
value: {
- parentReportID: targetReportID,
+ parentReportID: reportID,
parentReportActionID: optimisticMoneyRequestReportActionID,
- policyID: reportID !== CONST.REPORT.UNREPORTED_REPORT_ID && newReport ? newReport.policyID : CONST.POLICY.ID_FAKE,
+ policyID: reportID !== CONST.REPORT.UNREPORTED_REPORT_ID ? newReport.policyID : CONST.POLICY.ID_FAKE,
},
});
@@ -907,7 +789,7 @@ function changeTransactionsReport(transactionIDs: string[], reportID: string, po
let transactionThreadReportID = newIOUAction.childReportID;
let transactionThreadCreatedReportActionID;
if (!transactionThreadReportID) {
- const optimisticTransactionThread = buildTransactionThread(newIOUAction, reportID === CONST.REPORT.UNREPORTED_REPORT_ID ? undefined : newReport);
+ const optimisticTransactionThread = buildTransactionThread(newIOUAction, newReport);
const optimisticCreatedActionForTransactionThread = buildOptimisticCreatedReportAction(currentUserEmail);
transactionThreadReportID = optimisticTransactionThread.reportID;
transactionThreadCreatedReportActionID = optimisticCreatedActionForTransactionThread.reportActionID;
@@ -926,7 +808,7 @@ function changeTransactionsReport(transactionIDs: string[], reportID: string, po
},
{
onyxMethod: Onyx.METHOD.MERGE,
- key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${targetReportID}`,
+ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`,
value: {[newIOUAction.reportActionID]: {childReportID: optimisticTransactionThread.reportID}},
},
);
@@ -957,7 +839,7 @@ function changeTransactionsReport(transactionIDs: string[], reportID: string, po
},
{
onyxMethod: Onyx.METHOD.MERGE,
- key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${targetReportID}`,
+ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`,
value: {[newIOUAction.reportActionID]: {childReportID: null}},
},
);
@@ -966,7 +848,7 @@ function changeTransactionsReport(transactionIDs: string[], reportID: string, po
// 7. Add MOVED_TRANSACTION or UNREPORTED_TRANSACTION report actions
const movedAction =
reportID === CONST.REPORT.UNREPORTED_REPORT_ID
- ? buildOptimisticUnreportedTransactionAction(transactionThreadReportID, oldReportID)
+ ? buildOptimisticUnreportedTransactionAction(transactionThreadReportID, transaction.reportID)
: buildOptimisticMovedTransactionAction(transactionThreadReportID, reportID);
optimisticData.push({
@@ -987,8 +869,7 @@ function changeTransactionsReport(transactionIDs: string[], reportID: string, po
value: {[movedAction?.reportActionID]: null},
});
- // Create base transaction data object
- const baseTransactionData = {
+ transactionIDToReportActionAndThreadData[transaction.transactionID] = {
movedReportActionID: movedAction.reportActionID,
moneyRequestPreviewReportActionID: newIOUAction.reportActionID,
...(oldIOUAction && !oldIOUAction.childReportID
@@ -998,17 +879,6 @@ function changeTransactionsReport(transactionIDs: string[], reportID: string, po
}
: {}),
};
-
- if (!existingSelfDMReportID && reportID === CONST.REPORT.UNREPORTED_REPORT_ID) {
- // Add self DM data to transaction data
- transactionIDToReportActionAndThreadData[transaction.transactionID] = {
- ...baseTransactionData,
- selfDMReportID: selfDMReport.reportID,
- selfDMCreatedReportActionID: selfDMCreatedReportAction.reportActionID,
- };
- } else {
- transactionIDToReportActionAndThreadData[transaction.transactionID] = baseTransactionData;
- }
});
if (!transactionsMoved) {
diff --git a/src/pages/Search/SearchTransactionsChangeReport.tsx b/src/pages/Search/SearchTransactionsChangeReport.tsx
index dfec59598a5e..757510af9ace 100644
--- a/src/pages/Search/SearchTransactionsChangeReport.tsx
+++ b/src/pages/Search/SearchTransactionsChangeReport.tsx
@@ -5,7 +5,6 @@ import useOnyx from '@hooks/useOnyx';
import {changeTransactionsReport} from '@libs/actions/Transaction';
import Navigation from '@libs/Navigation/Navigation';
import IOURequestEditReportCommon from '@pages/iou/request/step/IOURequestEditReportCommon';
-import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {Report} from '@src/types/onyx';
@@ -41,22 +40,11 @@ function SearchTransactionsChangeReport() {
Navigation.goBack();
};
- const removeFromReport = () => {
- if (!transactionsReports || selectedTransactionsKeys.length === 0) {
- return;
- }
- changeTransactionsReport(selectedTransactionsKeys, CONST.REPORT.UNREPORTED_REPORT_ID);
- clearSelectedTransactions();
- Navigation.goBack();
- };
-
return (
);
}
diff --git a/src/pages/iou/request/step/IOURequestEditReport.tsx b/src/pages/iou/request/step/IOURequestEditReport.tsx
index 7513830014e0..3843f711b2f2 100644
--- a/src/pages/iou/request/step/IOURequestEditReport.tsx
+++ b/src/pages/iou/request/step/IOURequestEditReport.tsx
@@ -4,7 +4,6 @@ import type {ListItem} from '@components/SelectionList/types';
import useOnyx from '@hooks/useOnyx';
import {changeTransactionsReport} from '@libs/actions/Transaction';
import Navigation from '@libs/Navigation/Navigation';
-import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type SCREENS from '@src/SCREENS';
import IOURequestEditReportCommon from './IOURequestEditReportCommon';
@@ -36,22 +35,11 @@ function IOURequestEditReport({route}: IOURequestEditReportProps) {
Navigation.dismissModalWithReport({reportID: item.value});
};
- const removeFromReport = () => {
- if (!transactionReport || selectedTransactionIDs.length === 0) {
- return;
- }
- changeTransactionsReport(selectedTransactionIDs, CONST.REPORT.UNREPORTED_REPORT_ID);
- clearSelectedTransactions(true);
- Navigation.dismissModal();
- };
-
return (
);
}
diff --git a/src/pages/iou/request/step/IOURequestEditReportCommon.tsx b/src/pages/iou/request/step/IOURequestEditReportCommon.tsx
index cab6c66b3136..3d3dd999a719 100644
--- a/src/pages/iou/request/step/IOURequestEditReportCommon.tsx
+++ b/src/pages/iou/request/step/IOURequestEditReportCommon.tsx
@@ -1,7 +1,5 @@
import React, {useMemo} from 'react';
import type {OnyxEntry} from 'react-native-onyx';
-import * as Expensicons from '@components/Icon/Expensicons';
-import MenuItem from '@components/MenuItem';
import {useOptionsList} from '@components/OptionListContextProvider';
import SelectionList from '@components/SelectionList';
import InviteMemberListItem from '@components/SelectionList/InviteMemberListItem';
@@ -11,7 +9,7 @@ import useDebouncedState from '@hooks/useDebouncedState';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
import Navigation from '@libs/Navigation/Navigation';
-import {getOutstandingReportsForUser, getPolicyName, isIOUReport, sortOutstandingReportsBySelected} from '@libs/ReportUtils';
+import {getOutstandingReportsForUser, getPolicyName, sortOutstandingReportsBySelected} from '@libs/ReportUtils';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {Route} from '@src/ROUTES';
@@ -43,12 +41,9 @@ type Props = {
backTo: Route | undefined;
transactionsReports: Report[];
selectReport: (item: TransactionGroupListItem) => void;
- removeFromReport?: () => void;
- isEditing?: boolean;
- isUnreported?: boolean;
};
-function IOURequestEditReportCommon({backTo, transactionsReports, selectReport, removeFromReport, isEditing = false, isUnreported}: Props) {
+function IOURequestEditReportCommon({backTo, transactionsReports, selectReport}: Props) {
const {translate} = useLocalize();
const {options} = useOptionsList();
const [allReports] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {selector: (reports) => mapOnyxCollectionItems(reports, reportSelector), canBeMissing: true});
@@ -58,11 +53,6 @@ function IOURequestEditReportCommon({backTo, transactionsReports, selectReport,
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
const [searchValue, debouncedSearchValue, setSearchValue] = useDebouncedState('');
- const onlyReport = transactionsReports.length === 1 ? transactionsReports.at(0) : undefined;
- const isOwner = onlyReport ? onlyReport.ownerAccountID === currentUserPersonalDetails.accountID : false;
- const isReportIOU = onlyReport ? isIOUReport(onlyReport) : false;
- const shouldShowRemoveFromReport = isEditing && isOwner && !isReportIOU && !isUnreported;
-
const expenseReports = useMemo(
() =>
Object.values(allPoliciesID ?? {}).flatMap((policyID) => {
@@ -85,6 +75,8 @@ function IOURequestEditReportCommon({backTo, transactionsReports, selectReport,
return [];
}
+ const onlyReport = transactionsReports.length === 1 ? transactionsReports.at(0) : undefined;
+
return expenseReports
.sort((report1, report2) => sortOutstandingReportsBySelected(report1, report2, onlyReport?.reportID))
.filter((report) => !debouncedSearchValue || report?.reportName?.toLowerCase().includes(debouncedSearchValue.toLowerCase()))
@@ -98,7 +90,7 @@ function IOURequestEditReportCommon({backTo, transactionsReports, selectReport,
isSelected: onlyReport && report.reportID === onlyReport?.reportID,
};
});
- }, [allReports, debouncedSearchValue, expenseReports, onlyReport, options.reports]);
+ }, [allReports, debouncedSearchValue, expenseReports, options.reports, transactionsReports]);
const navigateBack = () => {
Navigation.goBack(backTo);
@@ -125,16 +117,6 @@ function IOURequestEditReportCommon({backTo, transactionsReports, selectReport,
headerMessage={headerMessage}
initiallyFocusedOptionKey={transactionsReports.length === 1 ? transactionsReports.at(0)?.reportID : undefined}
ListItem={InviteMemberListItem}
- listFooterContent={
- shouldShowRemoveFromReport ? (
-
- ) : undefined
- }
/>
);
diff --git a/src/pages/iou/request/step/IOURequestStepReport.tsx b/src/pages/iou/request/step/IOURequestStepReport.tsx
index b2def5999494..884f671283a6 100644
--- a/src/pages/iou/request/step/IOURequestStepReport.tsx
+++ b/src/pages/iou/request/step/IOURequestStepReport.tsx
@@ -2,7 +2,6 @@ import React from 'react';
import type {ListItem} from '@components/SelectionList/types';
import useOnyx from '@hooks/useOnyx';
import {changeTransactionsReport, setTransactionReport} from '@libs/actions/Transaction';
-import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID';
import Navigation from '@libs/Navigation/Navigation';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -22,9 +21,8 @@ type IOURequestStepReportProps = WithWritableReportOrNotFoundProps {
- if (!transaction) {
- return;
- }
- changeTransactionsReport([transaction.transactionID], CONST.REPORT.UNREPORTED_REPORT_ID);
- Navigation.dismissModal();
- };
-
return (
);
}