fix checkAndUpdateSafe logic (#379)

This commit is contained in:
Mikhail Mikheev 2019-12-18 15:23:13 +04:00 committed by Germán Martínez
parent d22f2ba3dd
commit 550d8b9a73
2 changed files with 718 additions and 25 deletions

View File

@ -63,14 +63,16 @@ export const checkAndUpdateSafe = (safeAddress: string) => async (dispatch: Redu
// If the remote owners does not contain a local address, we remove that local owner // If the remote owners does not contain a local address, we remove that local owner
localOwners.forEach((localAddress) => { localOwners.forEach((localAddress) => {
if (remoteOwners.findIndex((remoteAddress) => sameAddress(remoteAddress, localAddress)) !== -1) { const remoteOwnerIndex = remoteOwners.findIndex((remoteAddress) => sameAddress(remoteAddress, localAddress))
if (remoteOwnerIndex === -1) {
dispatch(removeSafeOwner({ safeAddress, ownerAddress: localAddress })) dispatch(removeSafeOwner({ safeAddress, ownerAddress: localAddress }))
} }
}) })
// If the remote has an owner that we don't have locally, we add it // If the remote has an owner that we don't have locally, we add it
remoteOwners.forEach((remoteAddress) => { remoteOwners.forEach((remoteAddress) => {
if (localOwners.findIndex((localAddress) => sameAddress(remoteAddress, localAddress)) !== -1) { const localOwnerIndex = localOwners.findIndex((localAddress) => sameAddress(remoteAddress, localAddress))
if (localOwnerIndex === -1) {
dispatch(addSafeOwner({ safeAddress, ownerAddress: remoteAddress, ownerName: 'UNKNOWN' })) dispatch(addSafeOwner({ safeAddress, ownerAddress: remoteAddress, ownerName: 'UNKNOWN' }))
} }
}) })

737
yarn.lock

File diff suppressed because it is too large Load Diff