Skip to content

Commit

Permalink
feat: allow update xblock fields without passing data (#35320)
Browse files Browse the repository at this point in the history
  • Loading branch information
rpenido authored Aug 27, 2024
1 parent 2e77e65 commit 9124e7b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion openedx/core/djangoapps/xblock/rest_api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,9 @@ def post(self, request, usage_key_str):
old_metadata = block.get_explicitly_set_fields_by_scope(Scope.settings)
old_content = block.get_explicitly_set_fields_by_scope(Scope.content)

block.data = data
# only update data if it was passed
if data is not None:
block.data = data

# update existing metadata with submitted metadata (which can be partial)
# IMPORTANT NOTE: if the client passed 'null' (None) for a piece of metadata that means 'remove it'.
Expand Down

0 comments on commit 9124e7b

Please sign in to comment.