Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make studio link tenant aware and remove preview #50

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading