From 8e7f43e8abee36b9df91a4728789cbc184c6b58c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrey=20Ca=C3=B1on?= <36200299+andrey-canon@users.noreply.github.com> Date: Mon, 9 Dec 2024 16:15:25 -0500 Subject: [PATCH] feat: make studio link tenant aware and remove preview (#50) * feat: make studio link tenant aware and remove preview (cherry picked from commit 6faf35531a2526a20dba9740ea85d7b458230197) * feat: make assets url tenant aware --- cms/djangoapps/contentstore/asset_storage_handlers.py | 7 ++++++- cms/djangoapps/contentstore/utils.py | 11 +---------- cms/templates/container.html | 2 +- common/djangoapps/util/course.py | 8 +++++++- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/cms/djangoapps/contentstore/asset_storage_handlers.py b/cms/djangoapps/contentstore/asset_storage_handlers.py index 281258e03a8d..4858c0e45f67 100644 --- a/cms/djangoapps/contentstore/asset_storage_handlers.py +++ b/cms/djangoapps/contentstore/asset_storage_handlers.py @@ -714,7 +714,12 @@ def get_asset_json(display_name, content_type, date, location, thumbnail_locatio Helper method for formatting the asset information to send to client. ''' asset_url = StaticContent.serialize_asset_key_with_slash(location) - external_url = urljoin(configuration_helpers.get_value('LMS_ROOT_URL', settings.LMS_ROOT_URL), asset_url) + lms_root = configuration_helpers.get_value_for_org( + location.org, + 'LMS_ROOT_URL', + settings.LMS_ROOT_URL + ) + external_url = urljoin(lms_root, asset_url) portable_url = StaticContent.get_static_path_from_location(location) usage_locations = [] if usage is None else usage return { diff --git a/cms/djangoapps/contentstore/utils.py b/cms/djangoapps/contentstore/utils.py index ad68ea0c4318..407acc64e2f9 100644 --- a/cms/djangoapps/contentstore/utils.py +++ b/cms/djangoapps/contentstore/utils.py @@ -178,7 +178,7 @@ def _remove_instructors(course_key): log.error(f"Error in deleting course groups for {course_key}: {err}") -def get_lms_link_for_item(location, preview=False): +def get_lms_link_for_item(location, preview=False): # pylint: disable=unused-argument """ Returns an LMS link to the course with a jump_to to the provided location. @@ -198,15 +198,6 @@ def get_lms_link_for_item(location, preview=False): if lms_base is None: return None - if preview: - # checks PREVIEW_LMS_BASE value in site configuration for the given course_org_filter(org) - # if not found returns settings.FEATURES.get('PREVIEW_LMS_BASE') - lms_base = SiteConfiguration.get_value_for_org( - location.org, - "PREVIEW_LMS_BASE", - settings.FEATURES.get('PREVIEW_LMS_BASE') - ) - return "//{lms_base}/courses/{course_key}/jump_to/{location}".format( lms_base=lms_base, course_key=str(location.course_key), diff --git a/cms/templates/container.html b/cms/templates/container.html index 488ad2a3b7f0..bf3abae65803 100644 --- a/cms/templates/container.html +++ b/cms/templates/container.html @@ -171,7 +171,7 @@