diff --git a/app/activitypub/routes.py b/app/activitypub/routes.py index 7508985c..498fdb92 100644 --- a/app/activitypub/routes.py +++ b/app/activitypub/routes.py @@ -1339,7 +1339,7 @@ def user_inbox(actor): activity_log.result = 'success' db.session.commit() if post_being_replied_to.author.is_local(): - inform_followers_of_post_update(post_being_replied_to, user.instance_id) + inform_followers_of_post_update(post_being_replied_to.id, user.instance_id) except VerificationError: activity_log.result = 'failure' diff --git a/app/activitypub/util.py b/app/activitypub/util.py index e6091e2e..4a23dd92 100644 --- a/app/activitypub/util.py +++ b/app/activitypub/util.py @@ -2557,15 +2557,16 @@ def resolve_remote_post_from_search(uri: str) -> Union[Post, None]: # This would need for posts to have things like a 'Replies' collection and a 'Likes' collection, so these can be downloaded when the post updates # Using collecions like this (as PeerTube does) circumvents the problem of not having a remote user's private key. # The problem of what to do for remote user's activity on a remote user's post in a local community still exists (can't Announce it, can't inform of post update) -def inform_followers_of_post_update(post: Post, sending_instance_id: int): +def inform_followers_of_post_update(post_id: int, sending_instance_id: int): if current_app.debug: - inform_followers_of_post_update_task(post, sending_instance_id) + inform_followers_of_post_update_task(post_id, sending_instance_id) else: - inform_followers_of_post_update_task.delay(post, sending_instance_id) + inform_followers_of_post_update_task.delay(post_id, sending_instance_id) @celery.task -def inform_followers_of_post_update_task(post: Post, sending_instance_id: int): +def inform_followers_of_post_update_task(post_id: int, sending_instance_id: int): + post = Post.query.get(post_id) page_json = post_to_page(post) page_json['updated'] = ap_datetime(utcnow()) update_json = { diff --git a/app/post/routes.py b/app/post/routes.py index 2c4b7952..d14af0ea 100644 --- a/app/post/routes.py +++ b/app/post/routes.py @@ -582,7 +582,7 @@ def poll_vote(post_id): poll_votes = PollChoice.query.join(PollChoiceVote, PollChoiceVote.choice_id == PollChoice.id).filter(PollChoiceVote.post_id == post.id, PollChoiceVote.user_id == current_user.id).all() for pv in poll_votes: if post.author.is_local(): - inform_followers_of_post_update(post, 1) + inform_followers_of_post_update(post.id, 1) else: pollvote_json = { '@context': default_context(),