From b417a915ed2e13fd5df36fa74959378c56164144 Mon Sep 17 00:00:00 2001
From: Puneet Lath <puneet@expensify.com>
Date: Wed, 28 Jun 2023 17:12:50 -0400
Subject: [PATCH 1/4] Remove personalDetails as part of migration

---
 src/libs/migrations/PersonalDetailsByAccountID.js | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/libs/migrations/PersonalDetailsByAccountID.js b/src/libs/migrations/PersonalDetailsByAccountID.js
index 2872e0ed1afe..85fe15318d2d 100644
--- a/src/libs/migrations/PersonalDetailsByAccountID.js
+++ b/src/libs/migrations/PersonalDetailsByAccountID.js
@@ -225,6 +225,12 @@ export default function () {
                 }
             });
 
+            // The personalDetails object has been replaced by personalDetailsList
+            // So if we find an instance of personalDetails we will clear it out
+            if (oldPersonalDetails) {
+                onyxData[DEPRECATED_ONYX_KEYS.PERSONAL_DETAILS] = null;
+            }
+
             return Onyx.multiSet(onyxData);
         },
     );

From c549da29b7334a3cdd7e4a5edf51b56de2ccbeaa Mon Sep 17 00:00:00 2001
From: Puneet Lath <puneet@expensify.com>
Date: Wed, 28 Jun 2023 17:19:22 -0400
Subject: [PATCH 2/4] Add test for removing personalDetails

---
 .../migrations/PersonalDetailsByAccountID.js  |  1 +
 tests/unit/MigrationTest.js                   | 25 +++++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/src/libs/migrations/PersonalDetailsByAccountID.js b/src/libs/migrations/PersonalDetailsByAccountID.js
index 85fe15318d2d..34b8ebabc150 100644
--- a/src/libs/migrations/PersonalDetailsByAccountID.js
+++ b/src/libs/migrations/PersonalDetailsByAccountID.js
@@ -228,6 +228,7 @@ export default function () {
             // The personalDetails object has been replaced by personalDetailsList
             // So if we find an instance of personalDetails we will clear it out
             if (oldPersonalDetails) {
+                Log.info('[Migrate Onyx] PersonalDetailsByAccountID migration: removing personalDetails');
                 onyxData[DEPRECATED_ONYX_KEYS.PERSONAL_DETAILS] = null;
             }
 
diff --git a/tests/unit/MigrationTest.js b/tests/unit/MigrationTest.js
index 6162bded793b..6ca3b5b2d516 100644
--- a/tests/unit/MigrationTest.js
+++ b/tests/unit/MigrationTest.js
@@ -845,5 +845,30 @@ describe('Migrations', () => {
                         },
                     });
                 }));
+
+        it('Should succeed in removing the personalDetails object if found in Onyx', () =>
+            Onyx.multiSet({
+                [`${DEPRECATED_ONYX_KEYS.PERSONAL_DETAILS}`]: {
+                    'test1@account.com': {
+                        accountID: 100,
+                        login: 'test1@account.com',
+                    },
+                    'test2@account.com': {
+                        accountID: 101,
+                        login: 'test2@account.com',
+                    },
+                },
+            })
+                .then(PersonalDetailsByAccountID)
+                .then(() => {
+                    expect(LogSpy).toHaveBeenCalledWith('[Migrate Onyx] PersonalDetailsByAccountID migration: removing personalDetails');
+                    const connectionID = Onyx.connect({
+                        key: DEPRECATED_ONYX_KEYS.PERSONAL_DETAILS,
+                        callback: (allPersonalDetails) => {
+                            Onyx.disconnect(connectionID);
+                            expect(allPersonalDetails).toBeNull();
+                        },
+                    });
+                }));
     });
 });

From d1d23ab4259dbf3803d19c0996f4aa23763fc580 Mon Sep 17 00:00:00 2001
From: Puneet Lath <puneet@expensify.com>
Date: Wed, 28 Jun 2023 12:21:12 -0400
Subject: [PATCH 3/4] Fix proptypes in ArchivedReportFooter for accountIDs
 instead of logins

---
 src/components/ArchivedReportFooter.js | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/components/ArchivedReportFooter.js b/src/components/ArchivedReportFooter.js
index a742b97fb0a9..1af8cadc80ca 100644
--- a/src/components/ArchivedReportFooter.js
+++ b/src/components/ArchivedReportFooter.js
@@ -22,11 +22,11 @@ const propTypes = {
             /** The reason the report was closed */
             reason: PropTypes.string.isRequired,
 
-            /** (For accountMerged reason only), the email of the previous owner of this report. */
-            oldLogin: PropTypes.string,
+            /** (For accountMerged reason only), the accountID of the previous owner of this report. */
+            oldAccountID: PropTypes.number,
 
-            /** (For accountMerged reason only), the email of the account the previous owner was merged into */
-            newLogin: PropTypes.string,
+            /** (For accountMerged reason only), the accountID of the account the previous owner was merged into */
+            newLogin: PropTypes.number,
         }).isRequired,
     }),
 

From 043b9e64339e4c437449183d1a56a7f4f58c900c Mon Sep 17 00:00:00 2001
From: Puneet Lath <puneet@expensify.com>
Date: Thu, 29 Jun 2023 10:02:22 -0400
Subject: [PATCH 4/4] Update src/components/ArchivedReportFooter.js

Co-authored-by: Alex Beaman <alexbeaman@expensify.com>
---
 src/components/ArchivedReportFooter.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/components/ArchivedReportFooter.js b/src/components/ArchivedReportFooter.js
index 1af8cadc80ca..d7a138d9a473 100644
--- a/src/components/ArchivedReportFooter.js
+++ b/src/components/ArchivedReportFooter.js
@@ -26,7 +26,7 @@ const propTypes = {
             oldAccountID: PropTypes.number,
 
             /** (For accountMerged reason only), the accountID of the account the previous owner was merged into */
-            newLogin: PropTypes.number,
+            newAccountID: PropTypes.number,
         }).isRequired,
     }),
 
