Skip to content

feat: enable Student Notes by default in InheritanceMixin#381

Closed
alenkadev wants to merge 7 commits into
release-ulmofrom
alenka/turn-Notes-on-by-default
Closed

feat: enable Student Notes by default in InheritanceMixin#381
alenkadev wants to merge 7 commits into
release-ulmofrom
alenka/turn-Notes-on-by-default

Conversation

@alenkadev

Copy link
Copy Markdown

Summary

Enable the Student Notes feature by default by changing the default value of the edxnotes setting in InheritanceMixin from False to True.

jira_link- https://2u-internal.atlassian.net/browse/LP-952

Copilot AI review requested due to automatic review settings July 10, 2026 11:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Enables the Student Notes feature by default for courses by changing the InheritanceMixin.edxnotes field default from False to True, so courses that don’t explicitly set this advanced setting will now have Student Notes enabled when the global ENABLE_EDXNOTES feature flag is on.

Changes:

  • Changed InheritanceMixin.edxnotes default from False to True to enable Student Notes by default at the course setting level.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings July 13, 2026 08:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread xmodule/tests/test_split_test_block.py Outdated
"""
def setUp(self):
super().setUp()
ApplicationFactory(name=settings.EDXNOTES_CLIENT_NAME)
Copilot AI review requested due to automatic review settings July 14, 2026 07:09
@alenkadev alenkadev force-pushed the alenka/turn-Notes-on-by-default branch from 881de37 to 8afcb00 Compare July 14, 2026 07:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread xmodule/tests/test_split_test_block.py Outdated
Comment on lines 65 to 66
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_EDXNOTES': False})
class SplitTestBlockTest(XModuleXmlImportTest, PartitionTestCase):
@alenkadev alenkadev force-pushed the alenka/turn-Notes-on-by-default branch from 8afcb00 to e1d803b Compare July 14, 2026 07:48
Copilot AI review requested due to automatic review settings July 14, 2026 07:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread xmodule/tests/test_split_test_block.py Outdated
Comment on lines +71 to +75
# Mock the OAuth2 client lookup for edxnotes to avoid infrastructure requirement in tests
oauth2_patcher = patch('openedx.core.djangoapps.oauth_dispatch.models.OAuth2Client.objects.get')
oauth2_patcher.return_value = Mock(client_id='edx-notes-test', redirect_uris='')
oauth2_patcher.start()
self.addCleanup(oauth2_patcher.stop)
Comment on lines 210 to 214
edxnotes = Boolean(
display_name=_("Enable Student Notes"),
help=_("Enter true or false. If true, students can use the Student Notes feature."),
default=False,
default=True,
scope=Scope.settings
Copilot AI review requested due to automatic review settings July 14, 2026 09:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

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

Comment on lines 210 to 214
edxnotes = Boolean(
display_name=_("Enable Student Notes"),
help=_("Enter true or false. If true, students can use the Student Notes feature."),
default=False,
default=True,
scope=Scope.settings
Comment on lines 210 to 214
edxnotes = Boolean(
display_name=_("Enable Student Notes"),
help=_("Enter true or false. If true, students can use the Student Notes feature."),
default=False,
default=True,
scope=Scope.settings
Copilot AI review requested due to automatic review settings July 14, 2026 09:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread xmodule/tests/test_split_test_block.py Outdated
Comment on lines +71 to +80
# Mock the OAuth2 client lookup for edxnotes to avoid infrastructure requirement in tests
mock_app = Mock()
mock_app.client_id = 'edx-notes-test'
mock_app.client_secret = 'test-secret'
oauth2_patcher = patch(
'lms.djangoapps.edxnotes.helpers.Application.objects.get',
return_value=mock_app,
)
oauth2_patcher.start()
self.addCleanup(oauth2_patcher.stop)
Comment on lines 210 to 215
edxnotes = Boolean(
display_name=_("Enable Student Notes"),
help=_("Enter true or false. If true, students can use the Student Notes feature."),
default=False,
default=True,
scope=Scope.settings
)
Copilot AI review requested due to automatic review settings July 14, 2026 09:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread xmodule/tests/test_split_test_block.py Outdated
Comment on lines +71 to +75
# Mock the OAuth2 client lookup for edxnotes to avoid infrastructure requirement in tests
oauth2_patcher = patch('lms.djangoapps.edxnotes.helpers.get_edxnotes_id_token')
mock_get_token = oauth2_patcher.start()
mock_get_token.return_value = 'test-token'
self.addCleanup(oauth2_patcher.stop)
Comment on lines 210 to 214
edxnotes = Boolean(
display_name=_("Enable Student Notes"),
help=_("Enter true or false. If true, students can use the Student Notes feature."),
default=False,
default=True,
scope=Scope.settings
Copilot AI review requested due to automatic review settings July 14, 2026 10:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread xmodule/tests/test_split_test_block.py Outdated
Comment on lines +72 to +75
oauth2_patcher = patch('lms.djangoapps.edxnotes.decorators.get_edxnotes_id_token')
mock_get_token = oauth2_patcher.start()
mock_get_token.return_value = 'test-token'
self.addCleanup(oauth2_patcher.stop)
Copilot AI review requested due to automatic review settings July 14, 2026 10:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread xmodule/tests/test_split_test_block.py Outdated
Comment on lines +71 to +74
# Mock the OAuth2 client lookup for edxnotes to avoid infrastructure requirement in tests
oauth2_patcher = patch('lms.djangoapps.edxnotes.helpers.get_edxnotes_id_token', return_value='test-token')
oauth2_patcher.start()
self.addCleanup(oauth2_patcher.stop)
Comment on lines 210 to 215
edxnotes = Boolean(
display_name=_("Enable Student Notes"),
help=_("Enter true or false. If true, students can use the Student Notes feature."),
default=False,
default=True,
scope=Scope.settings
)
Copilot AI review requested due to automatic review settings July 14, 2026 10:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread conftest.py Outdated
Comment on lines +21 to +22
@pytest.fixture(autouse=True)
def create_edxnotes_oauth_client(django_db_blocker):
Copilot AI review requested due to automatic review settings July 16, 2026 04:39
@alenkadev alenkadev force-pushed the alenka/turn-Notes-on-by-default branch from db318d4 to af01753 Compare July 16, 2026 04:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread lms/conftest.py Outdated
Comment on lines +7 to +17
@pytest.fixture(autouse=True)
def create_edxnotes_oauth_client(db):
"""
Create edx-notes OAuth2 Application for LMS tests.
"""
if settings.FEATURES.get('ENABLE_EDXNOTES', False):
from oauth2_provider.models import Application
from openedx.core.djangoapps.oauth_dispatch.tests.factories import ApplicationFactory

if not Application.objects.filter(name=settings.EDXNOTES_CLIENT_NAME).exists():
ApplicationFactory(name=settings.EDXNOTES_CLIENT_NAME)
Comment on lines +22 to +26
def test_app_disabled_by_default(self):
"""
Override base mixin behavior: Notes is enabled by default.
"""
assert self.course_app_class.is_enabled(self.course.id)
Copilot AI review requested due to automatic review settings July 16, 2026 05:03
@alenkadev alenkadev force-pushed the alenka/turn-Notes-on-by-default branch from af01753 to 8807fd6 Compare July 16, 2026 05:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

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

Comment on lines +22 to +27
def test_app_disabled_by_default(self):
"""
Override base mixin behavior: Notes is enabled by default.
"""
assert self.course_app_class.is_enabled(self.course.id)

Comment thread conftest.py Outdated
Comment on lines +21 to +38
@pytest.fixture(autouse=True)
def create_edxnotes_oauth_client(db):
"""
Create edx-notes OAuth2 Application for all tests when
ENABLE_EDXNOTES is enabled and the setting is configured.
"""
client_name = getattr(settings, 'EDXNOTES_CLIENT_NAME', None)
if not client_name:
return

if not getattr(settings, 'FEATURES', {}).get('ENABLE_EDXNOTES', False):
return

from oauth2_provider.models import Application
from openedx.core.djangoapps.oauth_dispatch.tests.factories import ApplicationFactory

if not Application.objects.filter(name=client_name).exists():
ApplicationFactory(name=client_name)
Copilot AI review requested due to automatic review settings July 16, 2026 05:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread conftest.py
Comment on lines +21 to +37
@pytest.fixture(autouse=True)
def create_edxnotes_oauth_client(db):
"""
Create edx-notes OAuth2 Application for all tests when
ENABLE_EDXNOTES is enabled and the setting is configured.

Uses direct model creation to avoid creating an extra User
(which breaks tests that count users or look them up by unique fields).
"""
client_name = getattr(settings, 'EDXNOTES_CLIENT_NAME', None)
if not client_name:
return

if not getattr(settings, 'FEATURES', {}).get('ENABLE_EDXNOTES', False):
return

from oauth2_provider.models import Application
Comment on lines +22 to +26
def test_app_disabled_by_default(self):
"""
Override base mixin behavior: Notes is enabled by default.
"""
assert self.course_app_class.is_enabled(self.course.id)
Copilot AI review requested due to automatic review settings July 16, 2026 06:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread conftest.py Outdated
Comment on lines +26 to +32
from django.test import SimpleTestCase, TestCase as DjangoTestCase

# Only run for tests with DB access.
if request.cls:
if issubclass(request.cls, SimpleTestCase) and not issubclass(request.cls, DjangoTestCase):
return

Comment on lines +22 to +26
def test_app_disabled_by_default(self):
"""
Override base mixin behavior: Notes is enabled by default.
"""
assert self.course_app_class.is_enabled(self.course.id)
Copilot AI review requested due to automatic review settings July 16, 2026 06:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

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

Comment on lines +22 to +26
def test_app_disabled_by_default(self):
"""
Override base mixin behavior: Notes is enabled by default.
"""
assert self.course_app_class.is_enabled(self.course.id)
Comment thread conftest.py
Comment on lines +28 to +33
# Only run for Django class-based tests with DB access.
if not request.cls:
return
if not issubclass(request.cls, TransactionTestCase):
return

Copilot AI review requested due to automatic review settings July 16, 2026 07:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

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

Comment on lines +22 to +27
def test_app_disabled_by_default(self):
"""
Override base mixin behavior: Notes is enabled by default.
"""
assert self.course_app_class.is_enabled(self.course.id)

Comment thread conftest.py
Comment on lines +20 to +24
@pytest.fixture(autouse=True)
def create_edxnotes_oauth_client(request):
"""
Create edx-notes OAuth2 Application for tests that have DB access
when ENABLE_EDXNOTES is enabled.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread xmodule/tests/test_split_test_block.py Outdated
self.split_test_block.runtime.modulestore = mocked_modulestore


# @patch.dict("django.conf.settings.FEATURES", {"ENABLE_EDXNOTES": False})
Comment thread xmodule/tests/test_split_test_block.py Outdated
assert len(children) == 2


# @patch.dict("django.conf.settings.FEATURES", {"ENABLE_EDXNOTES": False})
Comment on lines +22 to +26
def test_app_disabled_by_default(self):
"""
Override base mixin behavior: Notes is enabled by default.
"""
assert self.course_app_class.is_enabled(self.course.id)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

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

Comment on lines +22 to +26
def test_app_disabled_by_default(self):
"""
Override base mixin behavior: Notes is enabled by default.
"""
assert self.course_app_class.is_enabled(self.course.id)
Comment thread conftest.py
Comment on lines +28 to +32
# Only run for Django class-based tests with DB access.
if not request.cls:
return
if not issubclass(request.cls, TransactionTestCase):
return
Comment thread conftest.py
Comment on lines +49 to +55
if not Application.objects.filter(name=client_name).exists():
Application.objects.create(
name=client_name,
user=None,
client_type=Application.CLIENT_CONFIDENTIAL,
authorization_grant_type=Application.GRANT_CLIENT_CREDENTIALS,
)
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