feat(community-permissions): Adds addresses feild to check permissions request (#3858)

This commit is contained in:
Boris Melnik 2023-08-15 23:26:23 +06:00 committed by GitHub
parent 7eac9b170c
commit cd4ed51a25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 10 deletions

View File

@ -1 +1 @@
0.163.9
0.163.10

View File

@ -4257,16 +4257,21 @@ func (m *Messenger) CheckPermissionsToJoinCommunity(request *requests.CheckPermi
if err := request.Validate(); err != nil {
return nil, err
}
accounts, err := m.settings.GetActiveAccounts()
if err != nil {
return nil, err
}
var addresses []gethcommon.Address
for _, a := range accounts {
addresses = append(addresses, gethcommon.HexToAddress(a.Address.Hex()))
if len(request.Addresses) == 0 {
accounts, err := m.settings.GetActiveAccounts()
if err != nil {
return nil, err
}
for _, a := range accounts {
addresses = append(addresses, gethcommon.HexToAddress(a.Address.Hex()))
}
} else {
for _, v := range request.Addresses {
addresses = append(addresses, gethcommon.HexToAddress(v))
}
}
return m.communitiesManager.CheckPermissionToJoin(request.CommunityID, addresses)

View File

@ -11,7 +11,8 @@ var (
)
type CheckPermissionToJoinCommunity struct {
CommunityID types.HexBytes
CommunityID types.HexBytes `json:"communityId"`
Addresses []string `json:"addresses"`
}
func (u *CheckPermissionToJoinCommunity) Validate() error {