fix: Scope workspace user preference filter to current user#9261
Conversation
Without user=request.user on the PATCH filter, the ORM could match another user's preference record in the same workspace, causing pin/unpin state to leak across users or silently fail to persist. Fixes makeplane#9260 Signed-off-by: okxint <cashmein.eth@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughIn ChangesWorkspace User Preference Filter Fix
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
The
patchmethod inWorkspaceUserPreferencewas filtering bykeyandworkspace__slugonly. In a workspace with multiple users,.first()could grab a different user's preference row, so updating pin/sort state would either mutate the wrong user's data or leave the current user's preference unchanged — making sidebar state look like it didn't persist after refresh.The
getmethod already haduser=request.useron its queries. Added the same filter topatch.Closes #9260
Summary by CodeRabbit