feat!: enable authoring MFE markdown editor waffle for everyone by default (#36872)

This adds a migration to turn on the new React-based Markdown editing option
for newly-created ProblemBlocks for all authors. The option is nested
under "Advanced settings", just like the Advanced (OLX) problem editor.

The migration is written such that it will *not* overwrite an existing global
"No" waffle flag. Furthermore, our waffle utilities are designed such that
org-level and course-level overrides will still take preference over the flag
that the migration creates. Therefore, this should only take effect in cases
where no existing waffle flag applies.

BREAKING CHANGE: Operators who do not want the new React-based Markdown editor
to be shown should create a flag contentstore.use_react_markdown_editor with
the value "No".

We plan to backport this to Teak.
Prior art for flipping waffles like this: 9b0024376a
Part of: https://github.com/openedx/platform-roadmap/issues/384

Co-authored-by: Muhammad Anas <muhammad.anas@arbisoft.com>
This commit is contained in:
Kyle McCormick
2025-06-09 10:58:04 -04:00
committed by GitHub
parent b6cec3c67e
commit 29c1268d2b

View File

@@ -0,0 +1,25 @@
from django.db import migrations
from cms.djangoapps.contentstore.toggles import (
ENABLE_REACT_MARKDOWN_EDITOR
)
def create_flag(apps, schema_editor):
Flag = apps.get_model('waffle', 'Flag')
Flag.objects.get_or_create(
name=ENABLE_REACT_MARKDOWN_EDITOR.name, defaults={'everyone': True}
)
class Migration(migrations.Migration):
dependencies = [
('contentstore', '0010_container_link_models'),
('waffle', '0001_initial'),
]
operations = [
# Do not remove the flags for rollback. We don't want to lose originals if
# they already existed, and it won't hurt if they are created.
migrations.RunPython(create_flag, reverse_code=migrations.RunPython.noop),
]