Tweak reply processing

This commit is contained in:
Thomas Sileo 2019-09-03 22:24:30 +02:00
parent 2f0e99bda0
commit 90609468f1
2 changed files with 10 additions and 4 deletions

View file

@ -763,13 +763,17 @@ def handle_replies(create: ap.Create) -> None:
) )
return None return None
in_reply_to_data = {
MetaKey.IN_REPLY_TO: in_reply_to,
MetaKey.IN_REPLY_TO_URL: reply.get_url(),
}
# Update the activity to save some data about the reply # Update the activity to save some data about the reply
if reply.get_actor().id == create.get_actor().id: if reply.get_actor().id == create.get_actor().id:
in_reply_to_data = {MetaKey.IN_REPLY_TO_SELF: True} in_reply_to_data.update({MetaKey.IN_REPLY_TO_SELF: True})
else: else:
in_reply_to_data = { in_reply_to_data.update(
MetaKey.IN_REPLY_TO_ACTOR: reply.get_actor().to_dict(embed=True) {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)) update_one_activity(by_remote_id(create.id), upsert(in_reply_to_data))
# It's a regular reply, try to increment the reply counter # It's a regular reply, try to increment the reply counter

View file

@ -54,6 +54,8 @@ class MetaKey(Enum):
THREAD_ROOT_PARENT = "thread_root_parent" THREAD_ROOT_PARENT = "thread_root_parent"
IN_REPLY_TO = "in_reply_to"
IN_REPLY_TO_URL = "in_reply_to_url"
IN_REPLY_TO_SELF = "in_reply_to_self" IN_REPLY_TO_SELF = "in_reply_to_self"
IN_REPLY_TO_ACTOR = "in_reply_to_actor" IN_REPLY_TO_ACTOR = "in_reply_to_actor"