From 4953f310a621bc99540c4f332d1b6c58d068abff Mon Sep 17 00:00:00 2001
From: Georgia Monahan <38015950+grgia@users.noreply.github.com>
Date: Thu, 20 Nov 2025 17:56:21 +0000
Subject: [PATCH] Revert "feat: Add attendees field to unreported expenses"

---
 src/libs/TransactionUtils/index.ts            | 80 ++++++-------------
 .../request/step/IOURequestStepAttendees.tsx  |  4 +-
 .../step/IOURequestStepConfirmation.tsx       |  4 +-
 3 files changed, 28 insertions(+), 60 deletions(-)

diff --git a/src/libs/TransactionUtils/index.ts b/src/libs/TransactionUtils/index.ts
index 4ccad4bf2cd4..abcdb26bb148 100644
--- a/src/libs/TransactionUtils/index.ts
+++ b/src/libs/TransactionUtils/index.ts
@@ -451,7 +451,7 @@ function isMerchantMissing(transaction: OnyxEntry<Transaction>) {
  * Determine if we should show the attendee selector for a given expense on a give policy.
  */
 function shouldShowAttendees(iouType: IOUType, policy: OnyxEntry<Policy>): boolean {
-    if ((iouType !== CONST.IOU.TYPE.SUBMIT && iouType !== CONST.IOU.TYPE.CREATE && iouType !== CONST.IOU.TYPE.TRACK) || !policy?.id || policy?.type !== CONST.POLICY.TYPE.CORPORATE) {
+    if ((iouType !== CONST.IOU.TYPE.SUBMIT && iouType !== CONST.IOU.TYPE.CREATE) || !policy?.id || policy?.type !== CONST.POLICY.TYPE.CORPORATE) {
         return false;
     }
 
@@ -662,10 +662,6 @@ function getUpdatedTransaction({
     }
 
     if (Object.hasOwn(transactionChanges, 'attendees')) {
-        updatedTransaction.comment = {
-            ...updatedTransaction.comment,
-            attendees: transactionChanges.attendees,
-        };
         updatedTransaction.modifiedAttendees = transactionChanges?.attendees;
     }
 
@@ -887,61 +883,34 @@ function getMerchantOrDescription(transaction: OnyxEntry<Transaction>) {
     return !isMerchantMissing(transaction) ? getMerchant(transaction) : getDescription(transaction);
 }
 
-/**
- * Return report owner as default attendee
- * @param transaction
- */
-function getReportOwnerAsAttendee(transaction: OnyxInputOrEntry<Transaction>): Attendee | undefined {
-    if (transaction?.reportID === undefined) {
-        return;
-    }
-
-    // Get the creator of the transaction by looking at the owner of the report linked to the transaction
-    const report = getReportOrDraftReport(transaction?.reportID);
-    const creatorAccountID = report?.ownerAccountID;
-
-    if (creatorAccountID) {
-        const [creatorDetails] = getPersonalDetailsByIDs({accountIDs: [creatorAccountID], currentUserAccountID: deprecatedCurrentUserAccountID});
-        const creatorEmail = creatorDetails?.login ?? '';
-        const creatorDisplayName = creatorDetails?.displayName ?? creatorEmail;
-
-        if (creatorEmail) {
-            return {
-                email: creatorEmail,
-                login: creatorEmail,
-                displayName: creatorDisplayName,
-                accountID: creatorAccountID,
-                text: creatorDisplayName,
-                searchText: creatorDisplayName,
-                avatarUrl: creatorDetails?.avatarThumbnail ?? '',
-                selected: true,
-            };
-        }
-    }
-}
-
-/**
- * Return the list of attendees present on the transaction, if it's empty return report owner as default attendee
- * @param transaction
- */
-function getOriginalAttendees(transaction: OnyxInputOrEntry<Transaction>): Attendee[] {
-    const attendees = transaction?.comment?.attendees ?? [];
-    const currentUserAsAttendee = getReportOwnerAsAttendee(transaction);
-    if (attendees.length === 0 && transaction?.reportID && currentUserAsAttendee !== undefined) {
-        attendees.push(currentUserAsAttendee);
-    }
-    return attendees;
-}
-
 /**
  * Return the list of modified attendees if present otherwise list of attendees
- * @param transaction
  */
 function getAttendees(transaction: OnyxInputOrEntry<Transaction>): Attendee[] {
     const attendees = transaction?.modifiedAttendees ? transaction.modifiedAttendees : (transaction?.comment?.attendees ?? []);
-    const currentUserAsAttendee = getReportOwnerAsAttendee(transaction);
-    if (attendees.length === 0 && transaction?.reportID && currentUserAsAttendee !== undefined) {
-        attendees.push(currentUserAsAttendee);
+    if (attendees.length === 0 && transaction?.reportID) {
+        // Get the creator of the transaction by looking at the owner of the report linked to the transaction
+        const report = getReportOrDraftReport(transaction.reportID);
+        const creatorAccountID = report?.ownerAccountID;
+
+        if (creatorAccountID) {
+            const [creatorDetails] = getPersonalDetailsByIDs({accountIDs: [creatorAccountID], currentUserAccountID: deprecatedCurrentUserAccountID});
+            const creatorEmail = creatorDetails?.login ?? '';
+            const creatorDisplayName = creatorDetails?.displayName ?? creatorEmail;
+
+            if (creatorEmail) {
+                attendees.push({
+                    email: creatorEmail,
+                    login: creatorEmail,
+                    displayName: creatorDisplayName,
+                    accountID: creatorAccountID,
+                    text: creatorDisplayName,
+                    searchText: creatorDisplayName,
+                    avatarUrl: creatorDetails?.avatarThumbnail ?? '',
+                    selected: true,
+                });
+            }
+        }
     }
     return attendees;
 }
@@ -2229,7 +2198,6 @@ export {
     isCorporateCardTransaction,
     isExpenseUnreported,
     mergeProhibitedViolations,
-    getOriginalAttendees,
 };
 
 export type {TransactionChanges};
diff --git a/src/pages/iou/request/step/IOURequestStepAttendees.tsx b/src/pages/iou/request/step/IOURequestStepAttendees.tsx
index 41b08d8be56a..d3fc22d263d7 100644
--- a/src/pages/iou/request/step/IOURequestStepAttendees.tsx
+++ b/src/pages/iou/request/step/IOURequestStepAttendees.tsx
@@ -8,7 +8,7 @@ import useRestartOnReceiptFailure from '@hooks/useRestartOnReceiptFailure';
 import useTransactionViolations from '@hooks/useTransactionViolations';
 import {setMoneyRequestAttendees, updateMoneyRequestAttendees} from '@libs/actions/IOU';
 import Navigation from '@libs/Navigation/Navigation';
-import {getOriginalAttendees} from '@libs/TransactionUtils';
+import {getAttendees} from '@libs/TransactionUtils';
 import MoneyRequestAttendeeSelector from '@pages/iou/request/MoneyRequestAttendeeSelector';
 import CONST from '@src/CONST';
 import ONYXKEYS from '@src/ONYXKEYS';
@@ -43,7 +43,7 @@ function IOURequestStepAttendees({
     const isEditing = action === CONST.IOU.ACTION.EDIT;
     // eslint-disable-next-line rulesdir/no-default-id-values
     const [transaction] = useOnyx(`${isEditing ? ONYXKEYS.COLLECTION.TRANSACTION : ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID || CONST.DEFAULT_NUMBER_ID}`, {canBeMissing: true});
-    const [attendees, setAttendees] = useState<Attendee[]>(() => getOriginalAttendees(transaction));
+    const [attendees, setAttendees] = useState<Attendee[]>(() => getAttendees(transaction));
     const previousAttendees = usePrevious(attendees);
     const {translate} = useLocalize();
     const transactionViolations = useTransactionViolations(transactionID);
diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx
index 07ca039cf2cd..626134f12482 100644
--- a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx
+++ b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx
@@ -52,8 +52,8 @@ import {isPaidGroupPolicy} from '@libs/PolicyUtils';
 import {doesReportReceiverMatchParticipant, generateReportID, getReportOrDraftReport, isProcessingReport, isReportOutstanding, isSelectedManagerMcTest} from '@libs/ReportUtils';
 import {endSpan} from '@libs/telemetry/activeSpans';
 import {
+    getAttendees,
     getDefaultTaxCode,
-    getOriginalAttendees,
     getRateID,
     getRequestType,
     getValidWaypoints,
@@ -1289,7 +1289,7 @@ function IOURequestStepConfirmation({
                         transaction={transaction}
                         selectedParticipants={participants}
                         iouAmount={transaction?.amount ?? 0}
-                        iouAttendees={getOriginalAttendees(transaction)}
+                        iouAttendees={getAttendees(transaction)}
                         iouComment={transaction?.comment?.comment ?? ''}
                         iouCurrencyCode={transaction?.currency}
                         iouIsBillable={transaction?.billable}
