diff --git a/cms/djangoapps/contentstore/views/preview.py b/cms/djangoapps/contentstore/views/preview.py index 05fc1705e83e..b83158e35c76 100644 --- a/cms/djangoapps/contentstore/views/preview.py +++ b/cms/djangoapps/contentstore/views/preview.py @@ -200,6 +200,17 @@ def _prepare_runtime_for_preview(request, block): # See the docstring of `DjangoXBlockUserService`. deprecated_anonymous_user_id = anonymous_id_for_user(request.user, None) + # NOTE: As of Ulmo, these services only apply to the preview views. If you want a service to be present in all + # Studio ModuleStoreRuntimes, then add it to load_services_for_studio. + # HISTORICAL CONTEXT: Until Ulmo, the `block.runtime._services.update(service)` call below would + # actually update the services dictionary for all runtimes, as `_services` was aliased between them. + # This caused a grading bug, under certain conditions, so it was fixed + # in https://github.com/openedx/openedx-platform/pull/37825; now, every runtime gets a fresh, + # independent copy of `_services`. That's good, except that some Studio code had become dependent + # on the bugged behavior and thus expected the "preview" services below to be present in all Studio runtimes. + # We fixed the known instance of that bugged assumption here: + # https://github.com/openedx/openedx-platform/pull/37900. + # This comment is left here as a note for future devs investigating similar bugs. services = { "studio_user_permissions": StudioPermissionsService(request.user), "i18n": XBlockI18nService,