Skip to content

fix: scope main-feed pending queue to site_main posts#5030

Open
aseckin wants to merge 2 commits into
mainfrom
claude/issue-3216-show-only-main-feed-question
Open

fix: scope main-feed pending queue to site_main posts#5030
aseckin wants to merge 2 commits into
mainfrom
claude/issue-3216-show-only-main-feed-question

Conversation

@aseckin

@aseckin aseckin commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #3216

Summary

The main-feed pending queue (/questions/?status=pending) previously showed pending posts from any public project (anything with visibility=NORMAL, including tournaments and question series). This change scopes the pending branch in get_posts_feed() so that when for_main_feed=True, only posts with site_main as their default project or as an M2M project are returned. Other curation statuses and tournament-page queries are unaffected.

Test plan

  • New unit test test_get_posts_feed__pending_main_feed_excludes_tournament_posts covers the site_main/tournament/M2M cases
  • Manually verify /questions/?status=pending no longer shows pending tournament posts to curators/admins/creators of those tournaments
  • Manually verify tournament pending queues still show their own pending posts

Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Pending posts in the main feed are now limited to posts associated with the site’s main project.
    • Pending posts from tournament projects no longer appear in the main feed, while remaining available in other feed views.

The main-feed pending queue (/questions/?status=pending) previously
showed pending posts from any project with visibility=NORMAL, which
includes tournaments and question series. This meant users with elevated
permission on those projects saw foreign-tournament pending posts in the
main feed pending queue.

Restrict the pending status branch in get_posts_feed() to posts that
have site_main as their default project or as an M2M project when
for_main_feed=True. Other curation statuses and non-main-feed callers
(e.g. tournament pages) are unaffected.

Fixes #3216

Co-authored-by: aseckin <3686968+aseckin@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The feed service now limits pending posts in the main feed to posts associated with the site’s main project. Tests cover direct and many-to-many project associations and preserve broader behavior when main-feed filtering is disabled.

Changes

Main feed pending filtering

Layer / File(s) Summary
Apply main-project filtering to pending feed queries
posts/services/feed.py
Pending status queries in the main feed now require the site main project as either the default project or an associated project; other statuses retain existing filtering.
Test project-scoped pending results
tests/unit/test_posts/test_services/test_feed.py
Tests verify that main-project pending posts are included, tournament-only posts are excluded from the main feed, and tournament posts remain included without main-feed filtering.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: hlbmtc

Poem

I’m a bunny with a query to tune,
Keeping main-project posts in the queue.
Tournaments hop out of sight,
Unless main-feed bounds aren’t tight.
Tests nibble each case just right.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The code now restricts pending main-feed posts to site_main via default_project or M2M project membership, matching #3216.
Out of Scope Changes check ✅ Passed The changes stay focused on main-feed pending scoping and its test coverage, with no clear unrelated additions.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: scope main-feed pending queue to site_main posts' is specific and directly describes the main change: restricting the main-feed pending queue to site_main posts, which aligns with the PR objectives and file changes.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/issue-3216-show-only-main-feed-question

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

🚀 Preview Environment

Your preview environment is ready!

Resource Details
🌐 Preview URL https://metaculus-pr-5030-claude-issue-3216-show-only-ma-preview.mtcl.cc
📦 Docker Image ghcr.io/metaculus/metaculus:claude-issue-3216-show-only-main-feed-question-e4a84b4
🗄️ PostgreSQL NeonDB branch preview/pr-5030-claude-issue-3216-show-only-ma
Redis Fly Redis mtc-redis-pr-5030-claude-issue-3216-show-only-ma

Details

  • Commit: 3929b22c1698c6934e21bdfcb04d45c9eebba9a2
  • Branch: claude/issue-3216-show-only-main-feed-question
  • Fly App: metaculus-pr-5030-claude-issue-3216-show-only-ma

ℹ️ Preview Environment Info

Isolation:

  • PostgreSQL and Redis are fully isolated from production
  • Each PR gets its own database branch and Redis instance
  • Changes pushed to this PR will trigger a new deployment

Limitations:

  • Background workers and cron jobs are not deployed in preview environments
  • If you need to test background jobs, use Heroku staging environments

Cleanup:

  • This preview will be automatically destroyed when the PR is closed

@aseckin
aseckin requested a review from hlbmtc July 17, 2026 09:08
@aseckin
aseckin marked this pull request as ready for review July 17, 2026 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show only main feed question in the pending queue

1 participant