Skip to content

Feature: Adapt 2209 question state graphic only for question component#243

Open
Vaahwan wants to merge 2 commits into
developfrom
feature/ADAPT-2209-question-state-graphic-only-for-question-component
Open

Feature: Adapt 2209 question state graphic only for question component#243
Vaahwan wants to merge 2 commits into
developfrom
feature/ADAPT-2209-question-state-graphic-only-for-question-component

Conversation

@Vaahwan
Copy link
Copy Markdown

@Vaahwan Vaahwan commented May 20, 2026

✅ PR Completion Checklist

  • PR title follows format: Prefix: ADAPT-XXXX Brief description

    e.g. Feature: ADAPT-3648 Deprecate legacy plugins · Bugfix: ADAPT-2504 Failed import creates rogue course

  • JIRA ID linked in the Context section below
  • Plugin version updated in bower.json (if applicable)
  • npm run test-e2e-dev-pipeline executed and passing (NA)
  • No new issues reported by SonarLint (attach screenshot if applicable)
  • Own diff reviewed before requesting review
  • At least two reviewers added (Copilot set as default)

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.


@Vaahwan Vaahwan added the enhancement New feature or request label May 20, 2026
@Vaahwan Vaahwan self-assigned this May 20, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 _isQuestionType boolean on installed component plugin records during import/upload.
  • Add lib/questionComponentHelper.js to (a) detect question components at install time and (b) filter question-only extension schema properties for non-question components.
  • Apply filtering during /content/schema generation 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')
);
});
Comment thread lib/contentmanager.js
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 thread lib/contentmanager.js
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);
}
@Vaahwan Vaahwan changed the title Feature/adapt 2209 question state graphic only for question component Feature: Adapt 2209 question state graphic only for question component May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants