fix: scope main-feed pending queue to site_main posts#5030
Conversation
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>
📝 WalkthroughWalkthroughThe 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. ChangesMain feed pending filtering
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
🚀 Preview EnvironmentYour preview environment is ready!
Details
ℹ️ Preview Environment InfoIsolation:
Limitations:
Cleanup:
|
Fixes #3216
Summary
The main-feed pending queue (
/questions/?status=pending) previously showed pending posts from any public project (anything withvisibility=NORMAL, including tournaments and question series). This change scopes the pending branch inget_posts_feed()so that whenfor_main_feed=True, only posts withsite_mainas their default project or as an M2M project are returned. Other curation statuses and tournament-page queries are unaffected.Test plan
test_get_posts_feed__pending_main_feed_excludes_tournament_postscovers the site_main/tournament/M2M cases/questions/?status=pendingno longer shows pending tournament posts to curators/admins/creators of those tournamentsGenerated with Claude Code
Summary by CodeRabbit