From bd0d3fb9e80ac79e5739829e1e1817da2abc9a6d Mon Sep 17 00:00:00 2001 From: freamon Date: Sat, 12 Oct 2024 11:14:41 +0000 Subject: [PATCH] API: support 'Popular' listing type --- app/api/alpha/utils/post.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/api/alpha/utils/post.py b/app/api/alpha/utils/post.py index 563dd2bc..05f241ec 100644 --- a/app/api/alpha/utils/post.py +++ b/app/api/alpha/utils/post.py @@ -23,6 +23,8 @@ def cached_post_list(type, sort, user_id, community_id, community_name, person_i posts = Post.query.filter_by(deleted=False).join(Community, Community.id == Post.community_id).filter_by(show_all=True) elif type == "Local": posts = Post.query.filter_by(deleted=False).join(Community, Community.id == Post.community_id).filter_by(ap_id=None) + elif type == "Popular": + posts = Post.query.filter_by(deleted=False).join(Community, Community.id == Post.community_id).filter(Community.show_popular == True, Post.score > 100) elif type == "Subscribed" and user_id is not None: posts = Post.query.filter_by(deleted=False).join(CommunityMember, Post.community_id == CommunityMember.community_id).filter_by(is_banned=False, user_id=user_id) else: