🐛(backend) use computed_link_reach in handle_onboarding_document#2305
🐛(backend) use computed_link_reach in handle_onboarding_document#2305lunika wants to merge 1 commit into
Conversation
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
WalkthroughThis PR fixes a bug in onboarding document handling where sub-documents with inherited public access were not being added as favorites. The fix changes the restriction check in Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/backend/core/tests/test_models_users.py`:
- Around line 208-212: The test currently checks that a LinkTrace is created
after creating a user with
override_settings(USER_ONBOARDING_DOCUMENTS=[str(document.id)]) and
factories.UserFactory(); add an assertion that a DocumentFavorite was also
created for that user-document pair. Locate the test block around
override_settings and factories.UserFactory(), then assert using the
DocumentFavorite model (e.g., models.DocumentFavorite.objects.filter(user=user,
document=document).exists()) to ensure the favorite creation is verified
alongside models.LinkTrace.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: bab05a46-5088-4786-898a-58c72b884240
📒 Files selected for processing (3)
CHANGELOG.mdsrc/backend/core/models.pysrc/backend/core/tests/test_models_users.py
In the model method User::_handle_onboarding_documents_access we do not allow using documents with restricted link_reach to be added as onboarding documents. To check the real link_reach of the document, we must use instead the computed_link_reach to be sure that a sub document can also be used and compute its correct link_reach.
6b1c746 to
ea53b21
Compare
Purpose
In the model method User::_handle_onboarding_documents_access we do not allow using documents with restricted link_reach to be added as onboarding documents. To check the real link_reach of the document, we must use instead the computed_link_reach to be sure that a sub document can also be used and compute its correct link_reach.
Proposal
Fix #2015