Skip to content

Fix: enforce subtree depth limit for tree cascade children#33

Merged
stonebuzz merged 2 commits into
mainfrom
support_45061
Jul 1, 2026
Merged

Fix: enforce subtree depth limit for tree cascade children#33
stonebuzz merged 2 commits into
mainfrom
support_45061

Conversation

@Rom1-B

@Rom1-B Rom1-B commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Checklist before requesting a review

  • I have performed a self-review of my code.
  • I have added tests (when available) that prove my fix is effective or that my feature works.
  • I have updated the CHANGELOG with a short functional description of the fix or new feature.
  • This change requires a documentation update.

Description

  • It fixes !45061

The TreeDropdownChildrenController was stripping the level <= N condition from the WHERE clause before querying child items, causing the subtree depth limit configured on a Tree Cascade Dropdown question to be silently ignored.
Removing the unset restores the restriction so that AJAX child loading respects the configured depth.

Screenshots (if appropriate):

@AdrienClairembault AdrienClairembault requested review from Lainow and removed request for AdrienClairembault July 1, 2026 12:30
Comment thread tests/Model/QuestionType/TreeCascadeDropdownQuestionTest.php
@@ -502,6 +504,53 @@ public function testDropdownShowsNameNotCompletename(): void
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new test only exercises the children query path (verifying Level3 is excluded once depth is exceeded). It never exercises the parent_is_selectable path, which is fed by the same $condition_param that this fix restores. Can you add a test case where the controller is invoked with parent_id set to an item whose own level already exceeds subtree_depth (e.g. level3), and assert the response no longer renders the selectable placeholder (value="0") that parent_is_selectable controls in the twig template?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@Rom1-B Rom1-B requested a review from stonebuzz July 1, 2026 13:36
@stonebuzz stonebuzz merged commit a0ed928 into main Jul 1, 2026
3 checks passed
@stonebuzz stonebuzz deleted the support_45061 branch July 1, 2026 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants