Hide case management for ineligible question types#1230
Open
Hide case management for ineligible question types#1230
Conversation
Mug type augmentation moved from getMugTypes to postInit because SaveToCase was not present in getMugTypes since it is later in the list of enabled plugins. That could change, depending on how Vellum is configured by the host app, so better to put it in a place where all mug types will always be present.
The old way would break if a mug type used a `presence` function.
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.
Product Description
The Case Management section is now hidden for question types that cannot meaningfully be mapped to case properties. Specifically, the section no longer appears for:
The "auto-assign case name" action also now correctly skips these ineligible question types when picking the first question to use as the case name, and will insert a new hidden case-name question instead.
Technical Summary
caseProperty: { presence: 'notallowed' }out ofgetMugTypesand into a newpostInithook. This allowscaseProperty.presenceto be set onSaveToCase, which was not previously possible because thesaveToCaseplugin comes later in the call stack thancaseManagement(depending on configuration).getSectionDisplayso that any question whose ancestor chain contains aRepeatreturns an empty section. Previously an eligible question inside a Repeat still showed the Case Management UI.autoAssignNameso that when the first question is a type wherecasePropertyis not allowed (no spec or presence!== 'optional'), it inserts a new hiddencase-namedata node instead of attempting to reuse the ineligible question. UsesgetPresenceso mug-level overrides are respected.https://dimagi.atlassian.net/browse/SAAS-19672
https://dimagi.atlassian.net/browse/SAAS-19673
Feature Flag
FORMBUILDER_SAVE_TO_CASESafety Assurance
Safety story
This change only affects UI visibility of the Case Management section and which question types can be auto-selected as the case name. The underlying form XML and existing case mappings are unchanged. Existing forms that already have case properties set on now-excluded types will continue to function; the UI simply stops offering new mappings for them.
Automated test coverage
Yes.
Rollback instructions