From c8012ee8f33b52eb00c7a18bc5ffb19e8747dcb9 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Sun, 27 Oct 2019 14:53:00 +0100 Subject: [PATCH] Fix/tweak DMs sections --- blueprints/admin.py | 4 ++-- core/meta.py | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/blueprints/admin.py b/blueprints/admin.py index a17f597..f18025a 100644 --- a/blueprints/admin.py +++ b/blueprints/admin.py @@ -31,7 +31,7 @@ from core.db import find_one_activity 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_visibility +from core.meta import by_object_visibility from core.meta import follow_request_accepted from core.meta import in_outbox from core.meta import not_poll_answer @@ -384,7 +384,7 @@ def admin_direct_messages() -> _Response: { **not_poll_answer(), **by_type(ap.ActivityType.CREATE), - **by_visibility(ap.Visibility.DIRECT), + **by_object_visibility(ap.Visibility.DIRECT), } ).sort("meta.published", -1) diff --git a/core/meta.py b/core/meta.py index 4f6a9b5..6a0fc52 100644 --- a/core/meta.py +++ b/core/meta.py @@ -142,6 +142,10 @@ def by_visibility(vis: ap.Visibility) -> _SubQuery: return flag(MetaKey.VISIBILITY, vis.name) +def by_object_visibility(vis: ap.Visibility) -> _SubQuery: + return flag(MetaKey.OBJECT_VISIBILITY, vis.name) + + def by_hashtag(ht: str) -> _SubQuery: return flag(MetaKey.HASHTAGS, ht)