From 5df4d420debf586da0bf9119b2810461bed087ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Costa?= Date: Tue, 29 Nov 2022 23:08:43 +0100 Subject: [PATCH] Whitelist object types in the index query Select the outbox object types that we want to show on the notes page instead of removing objects that we don't want to show. That way, it's easier to ensure that there are no objects messing up the object count/empty checks. Partially fixes https://todo.sr.ht/~tsileo/microblog.pub/65 --- app/main.py | 2 +- app/templates/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/main.py b/app/main.py index df62d73..81ce131 100644 --- a/app/main.py +++ b/app/main.py @@ -296,7 +296,7 @@ async def index( models.OutboxObject.visibility == ap.VisibilityEnum.PUBLIC, models.OutboxObject.is_deleted.is_(False), models.OutboxObject.is_hidden_from_homepage.is_(False), - models.OutboxObject.ap_type != "Article", + models.OutboxObject.ap_type.in_(["Announce", "Note", "Video", "Question"]), ) q = select(models.OutboxObject).where(*where) total_count = await db_session.scalar( diff --git a/app/templates/index.html b/app/templates/index.html index f612102..5f5f4a7 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -26,7 +26,7 @@
{% for outbox_object in objects %} - {% if outbox_object.ap_type in ["Note", "Article", "Video", "Question"] %} + {% if outbox_object.ap_type in ["Note", "Video", "Question"] %} {{ utils.display_object(outbox_object) }} {% elif outbox_object.ap_type == "Announce" %}