From aad5d05954cd0e5eb0bd1849949408f89d15a1df Mon Sep 17 00:00:00 2001 From: magajh Date: Fri, 22 Oct 2021 09:37:52 -0400 Subject: [PATCH] LD-9: Remove preview and get urls for org --- 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 1e0d3e60c62..dff6833bd83 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 25fd7b955b1..ebb5d425306 100644 --- a/cms/djangoapps/contentstore/views/assets.py +++ b/cms/djangoapps/contentstore/views/assets.py @@ -593,7 +593,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) return { 'display_name': display_name, 'content_type': content_type, diff --git a/cms/templates/container.html b/cms/templates/container.html index 17de3d20ea7..ffafa8d96e2 100644 --- a/cms/templates/container.html +++ b/cms/templates/container.html @@ -138,7 +138,7 @@

${_("Page Actions")}

${_("View Live Version")} -