From 788cad653b8ec7a2b46916de4b2dfd5aabdbad8a Mon Sep 17 00:00:00 2001 From: freamon Date: Tue, 28 May 2024 20:44:06 +0100 Subject: [PATCH] Clobber PeerTube communitites to restrict posting to mods irrespective of what JSON says --- app/activitypub/util.py | 3 +++ app/community/util.py | 1 + 2 files changed, 4 insertions(+) diff --git a/app/activitypub/util.py b/app/activitypub/util.py index eb46b0a4..2f7810ee 100644 --- a/app/activitypub/util.py +++ b/app/activitypub/util.py @@ -611,6 +611,9 @@ def refresh_community_profile_task(community_id): new_language = find_language_or_create(ap_language['identifier'], ap_language['name']) if new_language not in community.languages: 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() if community.icon_id and icon_changed: make_image_sizes(community.icon_id, 60, 250, 'communities') diff --git a/app/community/util.py b/app/community/util.py index 3cd712df..81146573 100644 --- a/app/community/util.py +++ b/app/community/util.py @@ -94,6 +94,7 @@ def retrieve_peertube_mods_and_backfill(community_id: int, mods: list): else: new_membership = CommunityMember(community_id=community.id, user_id=user.id, is_moderator=True) db.session.add(new_membership) + community.restricted_to_mods = True db.session.commit() if community.ap_public_url: