Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to
### Fixed

- 🐛(docs) run migration 0027 without superuser role
- 🐛(backend) use computed_link_reach in handle_onboarding_document


## [v5.1.0] - 2026-05-11
Expand Down
2 changes: 1 addition & 1 deletion src/backend/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def _handle_onboarding_documents_access(self):
)
continue

if document.link_reach == LinkReachChoices.RESTRICTED:
if document.computed_link_reach == LinkReachChoices.RESTRICTED:
logger.warning(
"Onboarding on a restricted document is not allowed. Must be public or "
"connected. Restricted document: %s",
Expand Down
19 changes: 19 additions & 0 deletions src/backend/core/tests/test_models_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,25 @@ def test_models_users_handle_onboarding_documents_on_restricted_document_is_not_
assert not models.LinkTrace.objects.filter(user=user, document=document).exists()


def test_models_users_handle_onboarding_documents_computed_link_reach_not_restricted():
"""Test that the computed_link_reach is used to check the real link_reach is used."""

parent = factories.DocumentFactory(link_reach=models.LinkReachChoices.PUBLIC)
document = factories.DocumentFactory(
parent=parent, link_reach=models.LinkReachChoices.RESTRICTED
)

assert document.computed_link_reach == models.LinkReachChoices.PUBLIC

with override_settings(USER_ONBOARDING_DOCUMENTS=[str(document.id)]):
user = factories.UserFactory()

assert models.LinkTrace.objects.filter(user=user, document=document).exists()
user_favorites = models.DocumentFavorite.objects.filter(user=user)
assert user_favorites.count() == 1
assert user_favorites.filter(document=document).exists()

Comment thread
lunika marked this conversation as resolved.

@override_settings(USER_ONBOARDING_SANDBOX_DOCUMENT=None)
def test_models_users_duplicate_onboarding_sandbox_document_no_setting():
"""
Expand Down
Loading