Skip to content

Make ComponentVersions immutable - update how media is attached on their creation #561

@bradenmacdonald

Description

@bradenmacdonald

Problem 1: currently, you can call create_component_version_media to modify the media of any ComponentVersion, even one that is published or "historic". This could be considered a form of corrupting data.

"Problem" 2: code like this code for creating a library XBlock calls create_component_and_version and create_component_version_media which "feel" like they should be grouped together using bulk_draft_changes_for, but media APIs don't participate in draft change logs.

Suggestion: what do you think about modifying create_component_version_media so that it requires that it be used within a bulk changes context, and that the ComponentVersion in question is newly-created within the same bulk draft change context?

This would be a breaking API change but would enforce two best practices: only modifying ComponentVersion as they're created, and using bulk change contexts.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions