fix: add all members to channel when it is no longer token-gated

This commit is contained in:
Patryk Osmaczko 2023-07-26 16:13:31 +02:00 committed by osmaczko
parent 971fc0c816
commit cec81796dc
2 changed files with 6 additions and 0 deletions

View File

@ -2222,6 +2222,7 @@ func (o *Community) deleteTokenPermission(permissionID string) (*CommunityChange
delete(o.config.CommunityDescription.TokenPermissions, permissionID) delete(o.config.CommunityDescription.TokenPermissions, permissionID)
changes := o.emptyCommunityChanges() changes := o.emptyCommunityChanges()
changes.TokenPermissionsRemoved[permissionID] = permission changes.TokenPermissionsRemoved[permissionID] = permission
return changes, nil return changes, nil
} }

View File

@ -717,6 +717,11 @@ func (m *Manager) ReevaluateMembers(community *Community, removeAdmins bool) err
viewAndPostPermissions := community.ChannelTokenPermissionsByType(chatID, protobuf.CommunityTokenPermission_CAN_VIEW_AND_POST_CHANNEL) viewAndPostPermissions := community.ChannelTokenPermissionsByType(chatID, protobuf.CommunityTokenPermission_CAN_VIEW_AND_POST_CHANNEL)
if len(viewOnlyPermissions) == 0 && len(viewAndPostPermissions) == 0 { if len(viewOnlyPermissions) == 0 && len(viewAndPostPermissions) == 0 {
// ensure all members are added back if channel permissions were removed
_, err = community.PopulateChatWithAllMembers(channelID)
if err != nil {
return err
}
continue continue
} }