Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 20 additions & 10 deletions src/modules/migrate/controllers/MigrateCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shadowed user


if (autoMigrate) {
this.prevStep();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's already on the first step, doesn't it?

return null;
}

if (lockedUserByHash) {
this.startMigrate(lockedUserByHash);
const lockedUserByHash = this.userListLocked.find(lockedUser => (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

second O(n) - why?

multiAccount.hash(lockedUser.address) === id
));

if (lockedUserByHash) {
this.startMigrate(lockedUserByHash);
}
}
}
});
});
}

Expand Down