chore: optimize/correct the VideoBlock code (#38012)

- Change the `i18n` service declaration from `wants` to `needs`, since the
  runtime must provide it for the block to function correctly.

- Update the `public_view` webpack JS reference from `VideoBlockMain` to
  `VideoBlockDisplay`, as all VideoBlock JS files are bundled into
  `VideoBlockDisplay` and `VideoBlockMain` is not referring to anything
   or no longer exists in the repository.
This commit is contained in:
Muhammad Farhan Khan
2026-02-17 21:28:46 +05:00
committed by GitHub
parent a55c1ddabf
commit 8dd99defac

View File

@@ -105,8 +105,8 @@ EXPORT_IMPORT_COURSE_DIR = 'course'
EXPORT_IMPORT_STATIC_DIR = 'static'
@XBlock.wants('settings', 'completion', 'i18n', 'request_cache', 'video_config')
@XBlock.needs('mako', 'user')
@XBlock.wants('settings', 'completion', 'request_cache', 'video_config')
@XBlock.needs('mako', 'user', 'i18n')
class _BuiltInVideoBlock(
VideoFields, VideoTranscriptsMixin, VideoStudioViewHandlers, VideoStudentViewHandlers,
EmptyDataRawMixin, XmlMixin, EditingMixin, XModuleToXBlockMixin,
@@ -265,7 +265,7 @@ class _BuiltInVideoBlock(
fragment = Fragment(self.get_html(view=PUBLIC_VIEW, context=context))
add_css_to_fragment(fragment, 'VideoBlockDisplay.css')
add_webpack_js_to_fragment(fragment, 'VideoBlockMain')
add_webpack_js_to_fragment(fragment, 'VideoBlockDisplay')
fragment.initialize_js('Video')
return fragment