Add post pinning feature for project feeds - #5119
Conversation
Admins can now pin/unpin a post to the top of its default project's (tournament/community) feed via the post "···" dropdown menu. Pinned posts render a pin icon on their feed card. - Add Post.is_pinned field (+ migration) - Add ObjectPermission.can_pin_post (admin only) - Add pin_post/unpin_post services and a toggle-pin endpoint - Order pinned posts first in a single-project feed, scoped to the post's default project (reposts are unaffected) - Serialize is_pinned and wire up the frontend dropdown action + icon Closes #3223 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T4pYzdkyDaxzUry6iQP684
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks 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 |
|
Heads up on the one red check — it's infra, not the code. All code-relevant checks are green: Backend Checks, Frontend Checks, integration-tests, Email Template Checks, CodeQL (python/actions/js), and Docker build all pass. The only failure is Deploy Preview App, and it's unrelated to this diff. Fly's abuse filter rejects the auto-generated preview app name: The app name is derived from the branch name ( Generated by Claude Code |
…223-kip300 # Conflicts: # tests/unit/test_posts/test_services/test_feed.py
|
This pull request has been automatically marked as stale because it has not had recent activity. It will not be closed automatically, but please consider updating it or closing it if it is no longer relevant. |
Renumber the is_pinned migration 0033 -> 0034 to resolve a leaf-node collision with main's 0033_postusersnapshot_posts_postuser_forecasted_idx, and re-point its dependency at that migration. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T4pYzdkyDaxzUry6iQP684
🚀 Preview EnvironmentYour preview environment is ready!
Details
ℹ️ Preview Environment InfoIsolation:
Limitations:
Cleanup:
|
Summary
This PR adds the ability for project admins to pin posts to the top of their project's feed, similar to the existing comment pinning feature.
Key Changes
Backend:
is_pinnedboolean field to thePostmodel with database indexingpin_post()andunpin_post()service functions inposts/services/common.pypost_toggle_pin_api_view()endpoint that requires admin permissions to pin/unpin postsget_posts_feed()to apply pinned post ordering logic:Case/Whenannotation to prioritize pinned posts while maintaining secondary sort ordercan_pin_post()permission check toObjectPermissionclassFrontend:
togglePinPost()server action and API methodPosttype to includeis_pinnedfieldTests:
Implementation Details
default_projectrelationship, ensuring pins only apply to the project where the post was originally createdCase/Whenannotation to add a priority field (is_pinned_first) that sorts pinned posts first, then applies the requested orderinghttps://claude.ai/code/session_01T4pYzdkyDaxzUry6iQP684