diff --git a/app/admin/routes.py b/app/admin/routes.py index 5dd8e4e3..08221f70 100644 --- a/app/admin/routes.py +++ b/app/admin/routes.py @@ -424,6 +424,7 @@ def admin_community_edit(community_id): @permission_required('administer all communities') def admin_community_delete(community_id): community = Community.query.get_or_404(community_id) + community.banned = True # Unsubscribing everyone could take a long time so until that is completed hide this community from the UI by banning it. community.last_active = utcnow() @@ -431,6 +432,9 @@ def admin_community_delete(community_id): unsubscribe_everyone_then_delete(community.id) + reason = f"Community {community.name} deleted by {current_user.user_name}" + add_to_modlog('delete_community', reason=reason) + flash(_('Community deleted')) return redirect(url_for('admin.admin_communities')) diff --git a/app/community/routes.py b/app/community/routes.py index 94da3aee..c6b83094 100644 --- a/app/community/routes.py +++ b/app/community/routes.py @@ -951,13 +951,16 @@ def community_delete(community_id: int): if community.is_local(): community.banned = True # todo: federate deletion out to all instances. At end of federation process, delete_dependencies() and delete community + + # record for modlog + reason = f"Community {community.name} deleted by {current_user.user_name}" + add_to_modlog('delete_community', reason=reason) + + # actually delete the community community.delete_dependencies() db.session.delete(community) db.session.commit() - add_to_modlog('delete_community', community_id=community.id, link_text=community.display_name(), - link=community.link()) - flash(_('Community deleted')) return redirect('/communities')