From 9a618279b16a5bc089171e01296ee6ff360f9277 Mon Sep 17 00:00:00 2001 From: Johan Seto <51926076+johanseto@users.noreply.github.com> Date: Fri, 26 Jan 2024 17:50:58 -0500 Subject: [PATCH] feat: Make studio link tenant aware and remove preview (#6) (cherry picked from commit c54866cb68df32f0b2d06c57851bcd358e82d63b) --- cms/djangoapps/contentstore/utils.py | 11 +---------- cms/djangoapps/contentstore/views/assets.py | 7 ++++++- cms/templates/container.html | 2 +- common/djangoapps/util/course.py | 8 +++++++- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/cms/djangoapps/contentstore/utils.py b/cms/djangoapps/contentstore/utils.py index 7791bb681238..f51fa22313bc 100644 --- a/cms/djangoapps/contentstore/utils.py +++ b/cms/djangoapps/contentstore/utils.py @@ -104,7 +104,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. @@ -124,15 +124,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/djangoapps/contentstore/views/assets.py b/cms/djangoapps/contentstore/views/assets.py index 38f11db62c53..6224373017de 100644 --- a/cms/djangoapps/contentstore/views/assets.py +++ b/cms/djangoapps/contentstore/views/assets.py @@ -598,7 +598,12 @@ def _get_asset_json(display_name, content_type, date, location, thumbnail_locati 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) return { 'display_name': display_name, diff --git a/cms/templates/container.html b/cms/templates/container.html index 17de3d20ea76..ffafa8d96e26 100644 --- a/cms/templates/container.html +++ b/cms/templates/container.html @@ -138,7 +138,7 @@