Tiptap image links 0.30 questionnaires fixes - #7
Open
entantoencuanto wants to merge 12 commits into
Open
Conversation
When a question is hidden by its display condition, its response was left in place and questions conditioned on it were not re-evaluated. As a result, a question further down a chain (e.g. Q0 → Q3 → FINAL in the test) stayed visible even after an ancestor trigger stopped being fulfilled. `hideQuestion()` now clears the hidden question's response (unchecking radios/checkboxes and clearing text inputs) and fires a `change` event only on the inputs that actually changed. This lets questions conditioned on it re-evaluate their own display conditions, so hiding propagates down the chain and terminates instead of looping over already-cleared inputs. Add jest specs for display_conditions.component.js covering the direct condition, the intermediate question, and the cascading hide.
has_many through ignores the foreign_key attribute and a source is required because association name on the join model can't be inferred from the association name
`Question#display_conditions_for_other_questions` is keyed on `decidim_condition_question_id`, but declared `inverse_of: :question` and the `question` belongs_to on DisplayCondition is keyed on `decidim_question_id`. Because of this mismatched inverse_of, assigning a display condition's `condition_question` also re-stamped its owner FK (`decidim_question_id`) with the trigger question's id. In Decidim::Forms::Admin::UpdateQuestions the update attributes for each display condition include `condition_question` but not `question`, and `update!` persists every dirty attribute — so on every save (even with no changes) the condition was silently reassigned to its own trigger question. This corrupted questionnaires as admins added conditions: rules disappeared from the back-office and questions stopped displaying on the participant form.
The display-conditions fixes were authored against develop, which renamed answer_* to response_*. On this 0.30 fork the old naming is still in use, so the cherry-picks left references that do not exist here and would raise at runtime / fail specs: - questionnaire_copier.rb: eager-load :answer_options / :answer_option instead of :response_options / :response_option (the associations on this branch). - update_questions_spec.rb: use "answered", "short_answer", answer_option: and question_2_answer_options / decidim_answer_option_id. - display_conditions.component.test.js: match the real DOM input name [answer_option_id]. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This is an alternative to the hiding half of decidim#17321 . (cherry picked from commit 613c37c)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎩 What? Why?
Please describe your pull request.
📌 Related Issues
Link your PR to an issue
Testing
Describe the best way to test or validate your PR.
📷 Screenshots
Please add screenshots of the changes you are proposing
