From 0333f39b9e6ae6ec5f1ecf81865a1cfbe424ec0e Mon Sep 17 00:00:00 2001 From: xsanm Date: Thu, 16 Jan 2025 15:24:18 +0100 Subject: [PATCH] [native] fix creating new device list in `reorderAndSignDeviceList` Summary: Fix for [ENG-10102](https://linear.app/comm/issue/ENG-10102/non-primary-device-create-invalid-device-list-update-when-migrating). Depends on D14216 Test Plan: Tested that when running device list o non-primary new device list is properly created Reviewers: bartek, tomek Reviewed By: bartek, tomek Subscribers: ashoat Differential Revision: https://phab.comm.dev/D14217 --- native/backup/use-migration-to-new-flow.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/native/backup/use-migration-to-new-flow.js b/native/backup/use-migration-to-new-flow.js index 223694f934..e521b5d7f8 100644 --- a/native/backup/use-migration-to-new-flow.js +++ b/native/backup/use-migration-to-new-flow.js @@ -43,7 +43,10 @@ async function reorderAndSignDeviceList( const newDevices = thisDeviceIndex === 0 ? currentDevices - : [thisDeviceID, ...currentDevices.splice(thisDeviceIndex, 1)]; + : [ + thisDeviceID, + ...currentDevices.filter(deviceID => deviceID !== thisDeviceID), + ]; const rawList = composeRawDeviceList(newDevices); const signedList = await signDeviceListUpdate(rawList);