Merge PR #23779 courseware-api offer banner

* Commits:
  Get upgrade offer banner HTML in courseware API
This commit is contained in:
stvn
2020-04-22 15:37:52 -07:00
3 changed files with 8 additions and 0 deletions

View File

@@ -25,3 +25,7 @@
#seq_content .first-purchase-offer-banner {
max-width: $text-width-readability-max;
}
body.view-in-mfe .first-purchase-offer-banner {
display: none;
}

View File

@@ -79,6 +79,7 @@ class CourseInfoSerializer(serializers.Serializer): # pylint: disable=abstract-
media = _CourseApiMediaCollectionSerializer(source='*')
name = serializers.CharField(source='display_name_with_default_escaped')
number = serializers.CharField(source='display_number_with_default')
offer_html = serializers.CharField()
org = serializers.CharField(source='display_org_with_default')
short_description = serializers.CharField()
start = serializers.DateTimeField()

View File

@@ -18,6 +18,7 @@ from student.models import CourseEnrollment
from openedx.core.lib.api.view_utils import DeveloperErrorViewMixin
from openedx.features.content_type_gating.models import ContentTypeGatingConfig
from openedx.features.course_duration_limits.access import generate_course_expired_message
from openedx.features.discounts.utils import generate_offer_html
from xmodule.course_module import COURSE_VISIBILITY_PUBLIC
from .serializers import CourseInfoSerializer
@@ -117,6 +118,8 @@ class CoursewareInformation(RetrieveAPIView):
# TODO: TNL-7185 Legacy: Refactor to return the expiration date and format the message in the MFE
overview.course_expired_message = generate_course_expired_message(self.request.user, overview)
# TODO: TNL-7185 Legacy: Refactor to return the offer data and format the message in the MFE
overview.offer_html = generate_offer_html(self.request.user, overview)
course_key = CourseKey.from_string(self.kwargs['course_key_string'])
overview.content_type_gating_enabled = ContentTypeGatingConfig.enabled_for_enrollment(