Skip to content

Feature/lms youtube gdpr banner#7333

Open
gmorador-tribu wants to merge 5 commits intomainfrom
feature/lms-youtube-gdpr-banner
Open

Feature/lms youtube gdpr banner#7333
gmorador-tribu wants to merge 5 commits intomainfrom
feature/lms-youtube-gdpr-banner

Conversation

@gmorador-tribu
Copy link

Detect YouTube assignments and set client flag for GDPR banner

When building the JS config, detect when the document URL is a YouTube video and the YouTube service is enabled, and set hypothesisClient.youtubeAssignment = true so the client can show the YouTube/GDPR banner for those assignments.

Changes

  • YouTube URL detection: Add _youtube_video_id_from_url() and a regex for YouTube URLs (youtube.com, youtu.be, embed, shorts, live, etc.), aligned with frontend utils/youtube.ts.
  • JS config: In add_document_url(), when the URL is a YouTube video and the YouTube service is enabled, set hypothesisClient.youtubeAssignment = true.
  • Tests: Add unit tests for:
    • YouTube assignment sets the flag
    • Flag not set when YouTube service is disabled
    • Flag not set when the document URL is not YouTube
  • Lint: Fix ARG002 for unused via_url fixture in two tests.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds backend detection for YouTube document URLs during LMS LTI launches and exposes a hypothesisClient.youtubeAssignment flag so the frontend can show the YouTube/GDPR banner when appropriate.

Changes:

  • Add _youtube_video_id_from_url() and a YouTube video ID regex (mirroring frontend patterns).
  • Set hypothesisClient.youtubeAssignment = true in JSConfig.add_document_url() when the URL is a YouTube video and YouTubeService is enabled.
  • Add unit tests covering flag set/unset scenarios and ensure youtube_service fixture is available in the js-config test module.

Reviewed changes

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

File Description
lms/resources/_js_config/__init__.py Adds YouTube URL detection and sets a client flag during JS config build.
tests/unit/lms/resources/_js_config/__init___test.py Adds unit tests for the new youtubeAssignment client flag behavior.

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

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