Upload media referenced in note type templates/CSS on publish#1245
Upload media referenced in note type templates/CSS on publish#1245RisingOrange merged 2 commits intomainfrom
Conversation
Summary of ChangesHello @RisingOrange, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical issue where media files embedded in Anki note type templates or CSS were not being uploaded to AnkiHub when a deck owner published or updated note types. This oversight led to broken media links for subscribers. The changes ensure that any media referenced within these components is automatically detected and uploaded, providing a seamless experience for users and maintaining data integrity across shared decks. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
0257a17 to
685644b
Compare
When publishing a new note type or updating templates/styles via the decks dialog, extract media names from templates and CSS and trigger a background media upload so subscribers receive the referenced files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
685644b to
ebc6e0c
Compare
|
Thank you for catching that so quickly!
Did you mean to add tests? |
Add two parametrized tests to verify media upload behavior when publishing note types: - test_publish_note_type_media_upload: Tests media upload when publishing a new note type via "Publish note type" button - test_update_templates_media_upload: Tests media upload when publishing template/style updates via "Publish style/template updates" button Both tests verify that media_sync.start_media_upload is called with correct parameters when media is present, and not called when no media is present. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@abdnh Right, I forgot to add them. Added them now |
When deck owners publish a new note type or update templates/styles via the decks dialog, media files referenced in templates and CSS (e.g. background images, sounds) were not being uploaded. Subscribers would receive broken media references until a separate full media upload was triggered.
This adds media upload calls after note type publish operations, following the same pattern used in deck creation.
Related issues
https://ankihub.atlassian.net/browse/ACTV-270
get_media_names_from_notetype()for media download/sync, as well as media upload on deck creation, but missed to add media upload on note type creation/updateProposed changes
ankihub/gui/decks_dialog.py: Afteradd_note_type()andupdate_note_type_templates_and_styles(), extract media names from the note type's templates/CSS and trigger a background media upload viamedia_sync.start_media_upload()tests/addon/test_integration.py: Add parametrized tests (test_publish_note_type_media_uploadandtest_update_templates_media_upload) to verify media upload is triggered correctly when publishing note types with media, and not triggered when no media is presentHow to reproduce
<img src="image.png">) or CSS (e.g.background: url("bg.jpg"))Further comments
The
add_note_type_fieldsflow was intentionally excluded — it only updates"flds", not templates/CSS, so no new media is introduced.🤖 Generated with Claude Code