mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
Merge pull request 'Update community deletion modlog entry' (#287) from JollyDevelopment/pyfedi:jollydev/fix-delete-community-modlog-break into main
Reviewed-on: https://codeberg.org/rimu/pyfedi/pulls/287
This commit is contained in:
commit
407c80931d
2 changed files with 10 additions and 3 deletions
|
@ -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'))
|
||||
|
||||
|
|
|
@ -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')
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue