feat(community-permissions): Adds addresses feild to check permissions request (#3858)
This commit is contained in:
parent
7eac9b170c
commit
cd4ed51a25
|
@ -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)
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue