From 29c1268d2ba7036962718935d6850bc130f4aed3 Mon Sep 17 00:00:00 2001 From: Kyle McCormick Date: Mon, 9 Jun 2025 10:58:04 -0400 Subject: [PATCH] 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: 9b0024376a8fb3cb3f7402747735f9985551ff9f Part of: https://github.com/openedx/platform-roadmap/issues/384 Co-authored-by: Muhammad Anas --- ..._enable_markdown_editor_flag_by_default.py | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 cms/djangoapps/contentstore/migrations/0011_enable_markdown_editor_flag_by_default.py diff --git a/cms/djangoapps/contentstore/migrations/0011_enable_markdown_editor_flag_by_default.py b/cms/djangoapps/contentstore/migrations/0011_enable_markdown_editor_flag_by_default.py new file mode 100644 index 0000000000..491ae0e422 --- /dev/null +++ b/cms/djangoapps/contentstore/migrations/0011_enable_markdown_editor_flag_by_default.py @@ -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), + ]