Improve replies handling
This commit is contained in:
@@ -735,6 +735,15 @@ def handle_replies(create: ap.Create) -> None:
|
||||
)
|
||||
return None
|
||||
|
||||
# Update the activity to save some data about the reply
|
||||
if reply.get_actor().id == create.get_actor().id:
|
||||
in_reply_to_data = {MetaKey.IN_REPLY_TO_SELF: True}
|
||||
else:
|
||||
in_reply_to_data = {
|
||||
MetaKey.IN_REPLY_TO_ACTOR: reply.get_actor().to_dict(embed=True)
|
||||
}
|
||||
update_one_activity(by_remote_id(create.id), upsert(in_reply_to_data))
|
||||
|
||||
# It's a regular reply, try to increment the reply counter
|
||||
creply = DB.activities.find_one_and_update(
|
||||
{**by_object_id(in_reply_to), **by_type(ap.ActivityType.CREATE)},
|
||||
@@ -747,4 +756,4 @@ def handle_replies(create: ap.Create) -> None:
|
||||
)
|
||||
|
||||
# Spawn a task to process it (and determine if it needs to be saved)
|
||||
Tasks.process_reply(create.get_object().id)
|
||||
Tasks.process_reply(create.get_object_id())
|
||||
|
Reference in New Issue
Block a user