Feature: Adapt 2209 question state graphic only for question component#243
Open
Vaahwan wants to merge 2 commits into
Open
Feature: Adapt 2209 question state graphic only for question component#243Vaahwan wants to merge 2 commits into
Vaahwan wants to merge 2 commits into
Conversation
…nly question components
There was a problem hiding this comment.
Pull request overview
This PR addresses ADAPT-2209 by ensuring the “Question state graphic” extension field(s) are only exposed for question components (e.g., MCQ/Graphic MCQ), using a persisted _isQuestionType flag on component plugin records plus schema-time filtering of extension properties.
Changes:
- Persist a new
_isQuestionTypeboolean on installed component plugin records during import/upload. - Add
lib/questionComponentHelper.jsto (a) detect question components at install time and (b) filter question-only extension schema properties for non-question components. - Apply filtering during
/content/schemageneration so question-only extension attributes don’t appear for non-question component schemas.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| plugins/content/bower/index.js | Sets _isQuestionType when adding uploaded component packages to the DB. |
| plugins/content/bower/bowerplugin.schema | Adds _isQuestionType to the shared bower plugin DB schema. |
| lib/questionComponentHelper.js | New helper for question-component detection + extension-property filtering. |
| lib/contentmanager.js | Filters question-only extension fields out of non-question component schemas in /content/schema. |
| lib/bowermanager.js | Sets _isQuestionType when importing component packages via Bower manager flow. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+23
to
+29
| return fs.readdirSync(jsDir) | ||
| .filter(function(file) { return file.endsWith('.js'); }) | ||
| .some(function(file) { | ||
| return QUESTION_MODEL_PATTERN.test( | ||
| fs.readFileSync(path.join(jsDir, file), 'utf8') | ||
| ); | ||
| }); |
Comment on lines
+23
to
+29
| return fs.readdirSync(jsDir) | ||
| .filter(function(file) { return file.endsWith('.js'); }) | ||
| .some(function(file) { | ||
| return QUESTION_MODEL_PATTERN.test( | ||
| fs.readFileSync(path.join(jsDir, file), 'utf8') | ||
| ); | ||
| }); |
| if(schema._doc && schema._doc.component && schema.properties[plugin.settingsProperty]) { | ||
| var isComponentTypeSchema = (schema._doc && schema._doc.component) || schema.component; | ||
| if(isComponentTypeSchema && schema.properties[plugin.settingsProperty]) { | ||
| memoData = Object.assign({}, memo.contentModelData[pluginType].component, memoData); |
Comment on lines
+747
to
+752
| var isComponentTypeSchema = (schema._doc && schema._doc.component) || schema.component; | ||
| if(isComponentTypeSchema && schema.properties[plugin.settingsProperty]) { | ||
| memoData = Object.assign({}, memo.contentModelData[pluginType].component, memoData); | ||
| if (pluginType === 'extension') { | ||
| memoData = questionComponentHelper.filterQuestionOnlyExtensionProperties(memoData, schema); | ||
| } |
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.
✅ PR Completion Checklist
Prefix: ADAPT-XXXX Brief descriptionbower.json(if applicable)npm run test-e2e-dev-pipelineexecuted and passing (NA)Context
Resolves / Addresses ADAPT-2209
To make sure that "Question state graphic" extension should be visible only for question component and not for non-question component.
Question component means - MCQ, Graphic MCQ or Others.
These changes will make sure that "Question state graphic" component will not be visible in extension of non-question component.