♻️(backend) refactor get_select_options to take definitions dict

This will allow us to simplify the get_abilities method. It is also
more efficient because we have computed this definitions dict and
the the get_select_options method was doing the conversion again.
This commit is contained in:
Samuel Paccoud - DINUM
2025-04-24 08:59:30 +02:00
committed by Anthony LC
parent 18d46acd75
commit 8f67e382ba
4 changed files with 78 additions and 131 deletions

View File

@@ -819,7 +819,9 @@ class Document(MP_Node, BaseModel):
"ancestors_links_definitions": {
k: list(v) for k, v in ancestors_links_definitions.items()
},
"link_select_options": LinkReachChoices.get_select_options(ancestors_links),
"link_select_options": LinkReachChoices.get_select_options(
ancestors_links_definitions
),
"tree": can_get,
"update": can_update,
"versions_destroy": is_owner_or_admin,