forked from forks/microblog.pub
Fix threads display
This commit is contained in:
parent
fb97c66681
commit
9705f81360
2 changed files with 14 additions and 0 deletions
|
@ -27,6 +27,7 @@ from core.activitypub import Box
|
||||||
from core.activitypub import post_to_outbox
|
from core.activitypub import post_to_outbox
|
||||||
from core.db import find_one_activity
|
from core.db import find_one_activity
|
||||||
from core.meta import by_object_id
|
from core.meta import by_object_id
|
||||||
|
from core.meta import by_remote_id
|
||||||
from core.meta import by_type
|
from core.meta import by_type
|
||||||
from core.meta import follow_request_accepted
|
from core.meta import follow_request_accepted
|
||||||
from core.meta import in_outbox
|
from core.meta import in_outbox
|
||||||
|
@ -268,6 +269,13 @@ def admin_thread() -> _Response:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
data = find_one_activity({**by_type(ap.ActivityType.CREATE), **by_object_id(oid)})
|
data = find_one_activity({**by_type(ap.ActivityType.CREATE), **by_object_id(oid)})
|
||||||
|
if not data:
|
||||||
|
dat = DB.replies.find_one({**by_remote_id(oid)})
|
||||||
|
data = {
|
||||||
|
"activity": {"object": dat["activity"]},
|
||||||
|
"meta": dat["meta"],
|
||||||
|
"_id": dat["_id"],
|
||||||
|
}
|
||||||
|
|
||||||
if not data:
|
if not data:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
|
@ -23,6 +23,7 @@ from config import ME
|
||||||
from core import activitypub
|
from core import activitypub
|
||||||
from core.db import find_activities
|
from core.db import find_activities
|
||||||
from core.meta import MetaKey
|
from core.meta import MetaKey
|
||||||
|
from core.meta import by_object_id
|
||||||
from core.meta import by_type
|
from core.meta import by_type
|
||||||
from core.meta import flag
|
from core.meta import flag
|
||||||
from core.meta import not_deleted
|
from core.meta import not_deleted
|
||||||
|
@ -147,6 +148,11 @@ def _build_thread(data, include_children=True): # noqa: C901
|
||||||
)
|
)
|
||||||
|
|
||||||
replies = [data]
|
replies = [data]
|
||||||
|
for dat in find_activities(
|
||||||
|
{**by_object_id(root_id), **not_deleted(), **by_type(ap.ActivityType.CREATE)}
|
||||||
|
):
|
||||||
|
replies.append(dat)
|
||||||
|
|
||||||
for dat in find_activities(
|
for dat in find_activities(
|
||||||
{
|
{
|
||||||
**flag(MetaKey.THREAD_ROOT_PARENT, root_id),
|
**flag(MetaKey.THREAD_ROOT_PARENT, root_id),
|
||||||
|
|
Loading…
Reference in a new issue