mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Only notify first time lost ids are detected
This commit is contained in:
parent
f3b385cb09
commit
b858cc4b1b
@ -111,15 +111,17 @@ class PreferencesController {
|
||||
*/
|
||||
syncAddresses (addresses) {
|
||||
let { identities, lostIdentities } = this.store.getState()
|
||||
|
||||
let newlyLost = {}
|
||||
Object.keys(identities).forEach((identity) => {
|
||||
if (!addresses.includes(identity)) {
|
||||
delete identities[identity]
|
||||
lostIdentities[identity] = identities[identity]
|
||||
newlyLost[identity] = identities[identity]
|
||||
}
|
||||
})
|
||||
|
||||
// Identities are no longer present.
|
||||
if (Object.keys(lostIdentities).length > 0) {
|
||||
if (Object.keys(newlyLost).length > 0) {
|
||||
|
||||
// timeout to prevent blocking the thread:
|
||||
setTimeout(() => {
|
||||
@ -130,6 +132,10 @@ class PreferencesController {
|
||||
const uri = 'https://diagnostics.metamask.io/v1/orphanedAccounts'
|
||||
notifier.notify(uri, { accounts: Object.keys(lostIdentities) })
|
||||
.catch(log.error)
|
||||
|
||||
for (let key in newlyLost) {
|
||||
lostIdentities[key] = newlyLost[key]
|
||||
}
|
||||
}
|
||||
|
||||
this.store.updateState({ identities, lostIdentities })
|
||||
|
Loading…
Reference in New Issue
Block a user