fix: default to attaching all support chainIDs in membership requests

There's only one scenario in which a `RevealedAccount` will have an
empty `ChainIDs` list attached to it:

When the community in question requires users to satisfy certain
criteria to join, and the user's wallet does not own the necessary funds
on any of the supported chains.

If there are **no** permissions to join on the community, then we want
to reveal all (selected) accounts with all supported chainIDs.

This is necessary so that, once the community *does* become
permissioned, it'll have address + chain information from all joined
members.

Closes: https://github.com/status-im/status-desktop/issues/11255
This commit is contained in:
Pascal Precht 2023-06-28 10:32:29 +02:00 committed by r4bbit
parent 5f55a7bcc8
commit db65d42912
1 changed files with 11 additions and 0 deletions

View File

@ -1550,6 +1550,17 @@ func (m *Manager) CheckPermissionToJoin(id []byte, addresses []gethcommon.Addres
}
accountsAndChainIDs := combineAddressesAndChainIDs(addresses, allChainIDs)
if len(permissionsToJoin) == 0 {
// There are no permissions to join on this community at the moment,
// so we reveal all accounts + all chain IDs
response := &CheckPermissionsResponse{
Satisfied: true,
Permissions: make(map[string]*PermissionTokenCriteriaResult),
ValidCombinations: accountsAndChainIDs,
}
return response, nil
}
return m.checkPermissionToJoin(permissionsToJoin, accountsAndChainIDs, false)
}