Clobber PeerTube communitites to restrict posting to mods irrespective of what JSON says

This commit is contained in:
freamon 2024-05-28 20:44:06 +01:00
parent 3219a55d98
commit 788cad653b
2 changed files with 4 additions and 0 deletions

View file

@ -611,6 +611,9 @@ def refresh_community_profile_task(community_id):
new_language = find_language_or_create(ap_language['identifier'], ap_language['name']) new_language = find_language_or_create(ap_language['identifier'], ap_language['name'])
if new_language not in community.languages: if new_language not in community.languages:
community.languages.append(new_language) community.languages.append(new_language)
instance = Instance.query.get(community.instance_id)
if instance and instance.software == 'peertube':
community.restricted_to_mods = True
db.session.commit() db.session.commit()
if community.icon_id and icon_changed: if community.icon_id and icon_changed:
make_image_sizes(community.icon_id, 60, 250, 'communities') make_image_sizes(community.icon_id, 60, 250, 'communities')

View file

@ -94,6 +94,7 @@ def retrieve_peertube_mods_and_backfill(community_id: int, mods: list):
else: else:
new_membership = CommunityMember(community_id=community.id, user_id=user.id, is_moderator=True) new_membership = CommunityMember(community_id=community.id, user_id=user.id, is_moderator=True)
db.session.add(new_membership) db.session.add(new_membership)
community.restricted_to_mods = True
db.session.commit() db.session.commit()
if community.ap_public_url: if community.ap_public_url: