Repository navigation
fix(api): keep the sub type of a question fixed after creation - #3975
Merged
Merged
Conversation
updateQuestion rejects a change of `type`, but a PATCH could still change, add or remove `extraSettings.questionType`. A grid question could switch from radio to number after it already had answers, and the stored answers no longer matched the question. Reject an `extraSettings` update whose `questionType` differs from the stored one, with the same 403 response the `type` check uses. The check applies to every question type, so sub types added later are covered as well. The web frontend always sends the stored extra settings back, so normal editing is not affected. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Closed
1 task done
Chartman123
approved these changes
Nov 21, 2026
Collaborator
|
/backport to stable5.4 |
1 task done
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.
Problem
updateQuestionrejects a change oftype, but a PATCH could still change, add or removeextraSettings.questionType. A grid question could switch from radio to number after it already had answers, and the stored answers then no longer matched the question.Change
A PATCH whose
extraSettingshas a differentquestionTypethan the stored one is now rejected with the same 403 response as atypechange. The check is generic, so it covers every question type, not only grids. The linear scale sub types planned in #3635 and #3637 rely on it.The frontend is not affected: every
extraSettingssave spreads the stored settings, so it always sends the storedquestionTypeback. The grid editor has no control to change it. Copying a question and cloning a form copy the stored settings on the server side.docs/API_v3.mddocuments the new restriction.openapi.jsondoes not change.How to verify
subtype: radio.PATCH /api/v3/forms/{formId}/questions/{questionId}with{"keyValuePairs":{"extraSettings":{"questionType":"number"}}}returns 403. Sending{}also returns 403. Before this change, both returned 200."questionType":"radio"and other changes returns 200.🤖 AI (if applicable)