From 0c4e15f2c46c5449dbdb502e5674e4fd8ee485f8 Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Fri, 8 Nov 2024 15:27:56 +1300 Subject: [PATCH] show posts from child topics - rss --- app/topic/routes.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/topic/routes.py b/app/topic/routes.py index 6ac24bf9..16406ef2 100644 --- a/app/topic/routes.py +++ b/app/topic/routes.py @@ -151,7 +151,11 @@ def show_topic_rss(topic_path): topic = Topic.query.filter(Topic.machine_name == last_topic_machine_name.strip().lower()).first() if topic: - posts = Post.query.join(Community, Post.community_id == Community.id).filter(Community.topic_id == topic.id, + if topic.show_posts_in_children: # include posts from child topics + topic_ids = get_all_child_topic_ids(topic) + else: + topic_ids = [topic.id] + posts = Post.query.join(Community, Post.community_id == Community.id).filter(Community.topic_id.in_(topic_ids), Community.banned == False) posts = posts.filter(Post.from_bot == False, Post.nsfw == False, Post.nsfl == False, Post.deleted == False) posts = posts.order_by(desc(Post.created_at)).limit(100).all()