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 Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
|
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
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