From f9288f1fbf5454e6f895c20c35732d3119e1368b Mon Sep 17 00:00:00 2001 From: tsigel Date: Tue, 1 Oct 2019 15:32:39 +0300 Subject: [PATCH] DEXW-2169: fix --- .../migrate/controllers/MigrateCtrl.js | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/modules/migrate/controllers/MigrateCtrl.js b/src/modules/migrate/controllers/MigrateCtrl.js index 17d04785ea..3a13c0173f 100644 --- a/src/modules/migrate/controllers/MigrateCtrl.js +++ b/src/modules/migrate/controllers/MigrateCtrl.js @@ -33,26 +33,36 @@ user.getFilteredUserList(), user.getMultiAccountUsers() ]).then(([userList, multiAccountUsers]) => { + const { id } = $state.params; this.activeStep = userList && userList.length ? 0 : 1; this.userListLocked = userList; this.userListUnlocked = multiAccountUsers; - this.migrateUsersWithoutPassword(userList.filter(lockedUser => ( + const migrateWithoutPass = userList.filter(lockedUser => ( lockedUser.userType !== 'seed' && lockedUser.userType !== 'privateKey' - ))); + )); - const { id } = $state.params; + this.migrateUsersWithoutPassword(migrateWithoutPass).then(() => { + if (id) { - if (id) { - const lockedUserByHash = this.userListLocked.find(lockedUser => ( - multiAccount.hash(lockedUser.address) === id - )); + const autoMigrate = migrateWithoutPass.length && + migrateWithoutPass.some(user => multiAccount.hash(user.address) === id); + + if (autoMigrate) { + this.prevStep(); + return null; + } - if (lockedUserByHash) { - this.startMigrate(lockedUserByHash); + const lockedUserByHash = this.userListLocked.find(lockedUser => ( + multiAccount.hash(lockedUser.address) === id + )); + + if (lockedUserByHash) { + this.startMigrate(lockedUserByHash); + } } - } + }); }); }