diff --git a/app.py b/app.py index d897aaa..3e87d01 100644 --- a/app.py +++ b/app.py @@ -448,24 +448,24 @@ def api_posts(): if platform and post_data.get('platform', '').lower() != platform.lower(): continue - # Apply user's community preferences (before filterset) - if user_communities: - post_source = post_data.get('source', '').lower() - post_platform = post_data.get('platform', '').lower() + # Apply user's community preferences (before filterset) + if user_communities: + post_source = post_data.get('source', '').lower() + post_platform = post_data.get('platform', '').lower() - # Check if this post matches any of the user's selected communities - matches_community = False - for selected_community in user_communities: - selected_community = selected_community.lower() - # Match by exact source name or platform name - if (post_source == selected_community or - post_platform == selected_community or - selected_community in post_source): - matches_community = True - break + # Check if this post matches any of the user's selected communities + matches_community = False + for selected_community in user_communities: + selected_community = selected_community.lower() + # Match by exact source name or platform name + if (post_source == selected_community or + post_platform == selected_community or + selected_community in post_source): + matches_community = True + break - if not matches_community: - continue + if not matches_community: + continue # Apply search filter (before filterset) if search_query: