Fix reply counter

This commit is contained in:
Thomas Sileo
2019-08-16 21:16:25 +02:00
parent 7bd2aa4592
commit 852ffc00c6
3 changed files with 19 additions and 9 deletions

View File

@@ -548,6 +548,12 @@ def task_process_reply() -> _Response:
if not find_one_activity(by_object_id(root_reply)):
return ""
# In case the activity was from the inbox
update_one_activity(
{**by_object_id(activity.id), **by_type(ap.ActivityType.CREATE)},
upsert({MetaKey.THREAD_ROOT_PARENT: root_reply}),
)
for new_reply in new_replies:
if find_one_activity(by_object_id(new_reply.id)) or DB.replies.find_one(
{"remote_id": root_reply}
@@ -558,7 +564,7 @@ def task_process_reply() -> _Response:
save_reply(
new_reply,
{
"meta.thread_root_parent": root_reply,
**flag(MetaKey.THREAD_ROOT_PARENT, root_reply),
**flag(MetaKey.ACTOR, actor.to_dict(embed=True)),
**flag(MetaKey.ACTOR_HASH, _actor_hash(actor)),
},