diff --git a/app.py b/app.py index 76db79f..a0bc1c2 100644 --- a/app.py +++ b/app.py @@ -449,24 +449,23 @@ def api_posts(): continue # Apply user's community preferences (before filterset) - # Temporarily disabled to fix urgent feed issue for logged in users - # 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 - # - # if not matches_community: - # continue + 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 + + if not matches_community: + continue # Apply search filter (before filterset) if search_query: