Skip to content

Commit 3b2268d

Browse files
committed
refactor: Added send_block_updated_event in save_block
1 parent 229d233 commit 3b2268d

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

openedx/core/djangoapps/xblock/rest_api/views.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,6 @@ def xblock_handler(
212212
block = load_block(usage_key, user, version=version)
213213
# Run the handler, and save any resulting XBlock field value changes:
214214
response_webob = block.handle(handler_name, request_webob, suffix)
215-
216-
if handler_name == "studio_submit":
217-
# Signal that we've modified this block
218-
context_impl = get_learning_context_impl(usage_key)
219-
context_impl.send_block_updated_event(usage_key)
220-
221215
response = webob_to_django_response(response_webob)
222216
return response
223217

@@ -329,10 +323,6 @@ def post(self, request, usage_key, version: LatestVersion | int = LatestVersion.
329323
# Save after the callback so any changes made in the callback will get persisted.
330324
block.save()
331325

332-
# Signal that we've modified this block
333-
context_impl = get_learning_context_impl(usage_key)
334-
context_impl.send_block_updated_event(usage_key)
335-
336326
block_dict = {
337327
"id": str(block.usage_key),
338328
"display_name": get_block_display_name(block), # note this is also present in metadata

openedx/core/djangoapps/xblock/runtime/learning_core_runtime.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,10 @@ def save_block(self, block):
314314
)
315315
self.authored_data_store.mark_unchanged(block)
316316

317+
# Signal that we've modified this block
318+
learning_context = get_learning_context_impl(usage_key)
319+
learning_context.send_block_updated_event(usage_key)
320+
317321
def _get_component_from_usage_key(self, usage_key):
318322
"""
319323
Note that Components aren't ever really truly deleted, so this will

0 commit comments

Comments
 (0)