openedx / edx-platform

The Open edX LMS & Studio, powering education sites around the world!
https://openedx.org
GNU Affero General Public License v3.0
7.09k stars 3.79k forks source link

refactor: extract `save_xblock_to_user_clipboard` Python API #35027

Closed kdmccormick closed 1 day ago

kdmccormick commented 1 week ago

Description

Previously, the logic for copying an XBlock's OLX to the clipboard was directly in a POST view handler. This commit extracts it into a Python API function.

In order to keep models contained within api.py, we move some logic from the UserClipboard model to the UserClipboardData object and change the UserClipboardSerializer to accept the latter instead of the former. As an unavoidable side effect, this means that the source_context_title of the clipboard will not be available in Django admin.

In addition to following architectural guidelines [1], this change will help me develop the Content Libraries Relaunch, as I need a way to locally test library content reference via copy-paste while the UX for it is still being developed.

[1] https://docs.openedx.org/projects/openedx-proposals/en/latest/best-practices/oep-0049-django-app-patterns.html

Testing

When the PR sandbox is ready, before merging, I will manually verify that copy-paste still works as expected.

open-craft-grove commented 1 week ago

Sandbox deployment successful 🚀 🎓 LMS 📝 Studio ℹī¸ Grove Config, Tutor Config, Tutor Requirements

open-craft-grove commented 1 week ago

Sandbox deployment successful 🚀 🎓 LMS 📝 Studio ℹī¸ Grove Config, Tutor Config, Tutor Requirements

open-craft-grove commented 1 week ago

Sandbox deployment failed đŸ’Ĩ Please check the settings and requirements. Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description. 📜 Failure Logs ℹī¸ Grove Config, Tutor Config, Tutor Requirements

open-craft-grove commented 1 week ago

Sandbox deployment successful 🚀 🎓 LMS 📝 Studio ℹī¸ Grove Config, Tutor Config, Tutor Requirements

open-craft-grove commented 2 days ago

Sandbox deployment successful 🚀 🎓 LMS 📝 Studio ℹī¸ Grove Config, Tutor Config, Tutor Requirements

open-craft-grove commented 1 day ago

Sandbox deployment successful 🚀 🎓 LMS 📝 Studio ℹī¸ Grove Config, Tutor Config, Tutor Requirements

edx-pipeline-bot commented 1 day ago

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

edx-pipeline-bot commented 1 day ago

2U Release Notice: This PR has been deployed to the edX production environment.