🐛(backend) compute ancestor_links in get_abilities if needed

The refactor made in the tree view caching the ancestors_links to not
compute them again in the document.get_abilities method lead to a bug.
If the get_abilities method is called without ancestors_links, then they
are computed on all the ancestors but not from the highest readable
ancestor for the current user. We have to compute them with this
constraint.
This commit is contained in:
Manuel Raynaud
2025-03-24 10:46:40 +01:00
parent c882f1386c
commit a1914c6259
5 changed files with 90 additions and 4 deletions

View File

@@ -789,7 +789,7 @@ def test_api_documents_retrieve_user_roles(django_assert_max_num_queries):
)
expected_roles = {access.role for access in accesses}
with django_assert_max_num_queries(12):
with django_assert_max_num_queries(14):
response = client.get(f"/api/v1.0/documents/{document.id!s}/")
assert response.status_code == 200