From 5ea5db604b32817b8217ebef6d0971cd238a36ae Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Wed, 16 Oct 2019 00:04:47 +0200 Subject: [PATCH] Code cleanup --- core/meta.py | 1 - core/shared.py | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/core/meta.py b/core/meta.py index 7377cc0..4f6a9b5 100644 --- a/core/meta.py +++ b/core/meta.py @@ -9,7 +9,6 @@ from typing import Union from little_boxes import activitypub as ap _SubQuery = Dict[str, Any] -_Meta = Dict["MetaKey", Any] @unique diff --git a/core/shared.py b/core/shared.py index e7990c2..404a64a 100644 --- a/core/shared.py +++ b/core/shared.py @@ -146,11 +146,11 @@ def _build_thread(data, include_children=True, query=None): # noqa: C901 query = {} data["_requested"] = True app.logger.info(f"_build_thread({data!r})") - root_id = data["meta"].get(MetaKey.THREAD_ROOT_PARENT.value) - if not root_id: - root_id = data["meta"].get(MetaKey.OBJECT_ID.value) - if not root_id: - root_id = data["remote_id"] + root_id = ( + data["meta"].get(MetaKey.THREAD_ROOT_PARENT.value) + or data["meta"].get(MetaKey.OBJECT_ID.value) + or data["remote_id"] + ) replies = [data] for dat in find_activities(