Skip to content

Commit

Permalink
feat: make studio link tenant aware and remove preview (#50)
Browse files Browse the repository at this point in the history
* feat: make studio link tenant aware and remove preview

(cherry picked from commit 6faf355)

* feat: make assets url tenant aware
  • Loading branch information
andrey-canon authored Dec 9, 2024
1 parent e14f7e4 commit 8e7f43e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
7 changes: 6 additions & 1 deletion cms/djangoapps/contentstore/asset_storage_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
11 changes: 1 addition & 10 deletions cms/djangoapps/contentstore/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion cms/templates/container.html
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ <h3 class="sr">${_("Page Actions")}</h3>
<span class="action-button-text">${_("View Live Version")}</span>
</a>
</li>
<li class="action-item action-preview nav-item">
<li class="action-item action-preview nav-item" style="display: none">
<a href="${draft_preview_link}" class="button button-preview action-button" rel="external" title="${_('Preview the courseware in the LMS')}">
<span class="action-button-text">${_("Preview")}</span>
</a>
Expand Down
8 changes: 7 additions & 1 deletion common/djangoapps/util/course.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,14 @@ def get_link_for_about_page(course):
elif settings.FEATURES.get('ENABLE_MKTG_SITE') and getattr(course, 'marketing_url', None):
course_about_url = course.marketing_url
else:
about_base = configuration_helpers.get_value_for_org(
course.id.org,
'LMS_ROOT_URL',
settings.LMS_ROOT_URL
)

course_about_url = '{about_base_url}/courses/{course_key}/about'.format(
about_base_url=configuration_helpers.get_value('LMS_ROOT_URL', settings.LMS_ROOT_URL),
about_base_url=about_base,
course_key=str(course.id),
)

Expand Down

0 comments on commit 8e7f43e

Please sign in to comment.