feat(communities): add addresses to check channel permissions functions (#3910)
This commit is contained in:
parent
c0c74010e7
commit
5272f99b59
|
@ -4370,15 +4370,21 @@ func (m *Messenger) CheckCommunityChannelPermissions(request *requests.CheckComm
|
|||
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.CheckChannelPermissions(request.CommunityID, request.ChatID, addresses)
|
||||
|
@ -4389,15 +4395,21 @@ func (m *Messenger) CheckAllCommunityChannelsPermissions(request *requests.Check
|
|||
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.CheckAllChannelsPermissions(request.CommunityID, addresses)
|
||||
|
|
|
@ -12,6 +12,7 @@ var (
|
|||
|
||||
type CheckAllCommunityChannelsPermissions struct {
|
||||
CommunityID types.HexBytes
|
||||
Addresses []string `json:"addresses"`
|
||||
}
|
||||
|
||||
func (u *CheckAllCommunityChannelsPermissions) Validate() error {
|
||||
|
|
|
@ -14,6 +14,7 @@ var (
|
|||
type CheckCommunityChannelPermissions struct {
|
||||
CommunityID types.HexBytes
|
||||
ChatID string
|
||||
Addresses []string `json:"addresses"`
|
||||
}
|
||||
|
||||
func (u *CheckCommunityChannelPermissions) Validate() error {
|
||||
|
|
Loading…
Reference in New Issue