mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-24 11:51:27 -08:00
move federation network activity to celery tasks #268
This commit is contained in:
parent
de6e8a35e9
commit
1b61468559
1 changed files with 7 additions and 4 deletions
|
@ -1180,8 +1180,9 @@ def federate_post_edit_to_user_followers(post):
|
||||||
|
|
||||||
instances = Instance.query.join(User, User.instance_id == Instance.id).join(UserFollower, UserFollower.remote_user_id == User.id)
|
instances = Instance.query.join(User, User.instance_id == Instance.id).join(UserFollower, UserFollower.remote_user_id == User.id)
|
||||||
instances = instances.filter(UserFollower.local_user_id == post.user_id)
|
instances = instances.filter(UserFollower.local_user_id == post.user_id)
|
||||||
for i in instances:
|
for instance in instances:
|
||||||
post_request(i.inbox, update, current_user.private_key, current_user.public_url() + '#main-key')
|
if instance.inbox and not instance_banned(instance.domain):
|
||||||
|
post_request_in_background(instance.inbox, update, current_user.private_key, current_user.public_url() + '#main-key')
|
||||||
|
|
||||||
|
|
||||||
@bp.route('/post/<int:post_id>/delete', methods=['GET', 'POST'])
|
@bp.route('/post/<int:post_id>/delete', methods=['GET', 'POST'])
|
||||||
|
@ -1249,8 +1250,10 @@ def post_delete(post_id: int):
|
||||||
if followers:
|
if followers:
|
||||||
instances = Instance.query.join(User, User.instance_id == Instance.id).join(UserFollower, UserFollower.remote_user_id == User.id)
|
instances = Instance.query.join(User, User.instance_id == Instance.id).join(UserFollower, UserFollower.remote_user_id == User.id)
|
||||||
instances = instances.filter(UserFollower.local_user_id == post.user_id)
|
instances = instances.filter(UserFollower.local_user_id == post.user_id)
|
||||||
for i in instances:
|
for instance in instances:
|
||||||
post_request(i.inbox, delete_json, current_user.private_key, current_user.public_url() + '#main-key')
|
if instance.inbox and not current_user.has_blocked_instance(instance.id) and not instance_banned(
|
||||||
|
instance.domain):
|
||||||
|
post_request_in_background(instance.inbox, delete_json, current_user.private_key, current_user.public_url() + '#main-key')
|
||||||
|
|
||||||
if post.user_id != current_user.id:
|
if post.user_id != current_user.id:
|
||||||
add_to_modlog('delete_post', community_id=community.id, link_text=shorten_string(post.title),
|
add_to_modlog('delete_post', community_id=community.id, link_text=shorten_string(post.title),
|
||||||
|
|
Loading…
Add table
Reference in a new issue