fix(community): only checkPermissions if the community has permissions

This commit is contained in:
Jonathan Rainville 2023-03-24 11:43:53 -04:00
parent 79365ef576
commit 329f5c8316
2 changed files with 5 additions and 1 deletions

View File

@ -1433,6 +1433,10 @@ func (o *Community) TokenPermissions() map[string]*protobuf.CommunityTokenPermis
return o.config.CommunityDescription.TokenPermissions
}
func (o *Community) HasTokenPermissions() bool {
return len(o.config.CommunityDescription.TokenPermissions) > 0
}
func (o *Community) TokenPermissionsByType(permissionType protobuf.CommunityTokenPermission_Type) []*protobuf.CommunityTokenPermission {
permissions := make([]*protobuf.CommunityTokenPermission, 0)
for _, tokenPermission := range o.TokenPermissions() {

View File

@ -732,7 +732,7 @@ func (m *Messenger) Start() (*MessengerResponse, error) {
}()
for _, c := range adminCommunities {
if c.Joined() {
if c.Joined() && c.HasTokenPermissions() {
go m.communitiesManager.CheckMemberPermissionsPeriodically(c.ID())
}
}