Skip to content

Conversation

@mraman-2U
Copy link
Member

@mraman-2U mraman-2U commented Oct 21, 2025

This pull request refactors the Chat component to remove feature-specific logic and enable a more generic, plugin-based architecture for learner tools. The changes simplify the component, delegate feature gating to plugins, and update related configuration and tests. The most important changes are:

Refactor to Plugin-Based Architecture:

  • The Chat component (src/courseware/course/chat/Chat.jsx) is rewritten to remove all feature-specific logic (such as enrollment mode checks, exam state, and date validation) and instead renders a generic PluginSlot with minimal context (courseId, unitId, userId, isStaff, enrollmentMode). Plugins are now responsible for their own gating and requirements.
  • The prop contentToolsEnabled is removed from Chat as it is no longer needed in the generic context.

Testing Overhaul:

  • The Chat component test suite (src/courseware/course/chat/Chat.test.jsx) is completely rewritten. Tests now focus on verifying that PluginSlot is rendered when enabled, receives the correct props, and does not render when disabled. All previous feature-specific tests and mocks are removed, and a new strategy is used to mock and spy on PluginSlot props.

Openedx PR: openedx#1810

Configuration Updates:

  • In .env.development, the BASE_URL and PORT are updated to use port 2010 instead of 2000, and the ENABLE_XPERT_AUDIT flag is added (previously FEATURE_ENABLE_CHAT_V2_ENDPOINT). [1] [2] [3]
  • Minor whitespace cleanup in .env.

Copilot AI review requested due to automatic review settings October 21, 2025 15:55
Copy link

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 pull request refactors the Chat component to adopt a plugin-based architecture, removing feature-specific logic and delegating gating responsibilities to plugins via PluginSlot. The changes simplify the component's responsibilities and update related configuration and tests.

Key changes:

  • Replaced feature-specific rendering logic in Chat with a generic PluginSlot that provides minimal context (courseId, unitId, userId, isStaff, enrollmentMode)
  • Rewrote test suite to focus on PluginSlot integration rather than feature-specific behavior
  • Updated environment configuration to use port 2010 and replaced FEATURE_ENABLE_CHAT_V2_ENDPOINT with ENABLE_XPERT_AUDIT

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/courseware/course/chat/Chat.jsx Simplified component to render PluginSlot instead of Xpert, removing all enrollment mode checks, exam state validation, and date logic
src/courseware/course/chat/Chat.test.jsx Complete test rewrite focusing on PluginSlot rendering and prop passing rather than feature-specific visibility rules
.env.development Updated port from 2000 to 2010 and replaced FEATURE_ENABLE_CHAT_V2_ENDPOINT with ENABLE_XPERT_AUDIT
.env Removed FEATURE_ENABLE_CHAT_V2_ENDPOINT declaration

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@mraman-2U mraman-2U changed the title feat: update chat component to use PluginSlot and simplify logic feat: update chat component to use PluginSlot Oct 21, 2025
@nsprenkle nsprenkle changed the base branch from master to release-teak October 28, 2025 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants