Merge pull request #36436 from openedx/feanil/remove_courseware_sock

feat!: Remove the course sock and related APIs.
This commit is contained in:
Feanil Patel
2025-04-09 10:14:09 -04:00
committed by GitHub
17 changed files with 7 additions and 614 deletions

View File

@@ -31,7 +31,6 @@ from openedx.core.djangoapps.user_api.tests.factories import UserCourseTagFactor
from openedx.features.course_duration_limits.models import CourseDurationLimitConfig
from openedx.features.course_experience import (
COURSE_ENABLE_UNENROLLED_ACCESS_FLAG,
DISPLAY_COURSE_SOCK_FLAG,
ENABLE_COURSE_GOALS
)
from openedx.features.discounts.applicability import (
@@ -362,12 +361,6 @@ class OutlineTabTestViews(BaseCourseHomeTests):
assert (data['access_expiration'] is not None) == show_enrolled
assert (data['resume_course']['url'] is not None) == show_enrolled
@ddt.data(True, False)
def test_can_show_upgrade_sock(self, sock_enabled):
with override_waffle_flag(DISPLAY_COURSE_SOCK_FLAG, active=sock_enabled):
response = self.client.get(self.url)
assert response.data['can_show_upgrade_sock'] == sock_enabled
def test_verified_mode(self):
enrollment = CourseEnrollment.enroll(self.user, self.course.id)
CourseDurationLimitConfig.objects.create(enabled=True, enabled_as_of=datetime(2018, 1, 1))

View File

@@ -9,7 +9,6 @@ from rest_framework import serializers
from lms.djangoapps.courseware.utils import verified_upgrade_deadline_link
from openedx.core.djangoapps.courseware_api.utils import serialize_upgrade_info
from openedx.features.content_type_gating.models import ContentTypeGatingConfig
from openedx.features.course_experience import DISPLAY_COURSE_SOCK_FLAG
from openedx.features.course_experience.utils import dates_banner_should_display
@@ -59,13 +58,8 @@ class VerifiedModeSerializer(ReadOnlySerializer):
Requires 'course_overview', 'enrollment', and 'request' from self.context.
"""
can_show_upgrade_sock = serializers.SerializerMethodField()
verified_mode = serializers.SerializerMethodField()
def get_can_show_upgrade_sock(self, _):
course_overview = self.context['course_overview']
return DISPLAY_COURSE_SOCK_FLAG.is_enabled(course_overview.id)
def get_verified_mode(self, _):
"""Return verified mode information, or None."""
course_overview = self.context['course_overview']

View File

@@ -341,7 +341,7 @@ class IndexQueryTestCase(ModuleStoreTestCase):
self.client.login(username=self.user.username, password=self.user_password)
CourseEnrollment.enroll(self.user, course.id)
with self.assertNumQueries(154, table_ignorelist=QUERY_COUNT_TABLE_IGNORELIST):
with self.assertNumQueries(152, table_ignorelist=QUERY_COUNT_TABLE_IGNORELIST):
with check_mongo_calls(3):
url = reverse(
'courseware_section',

View File

@@ -48,7 +48,6 @@ from openedx.features.course_experience import (
default_course_url
)
from openedx.features.course_experience.url_helpers import make_learning_mfe_courseware_url
from openedx.features.course_experience.views.course_sock import CourseSockFragmentView
from openedx.features.enterprise_support.api import data_sharing_consent_required
from ..access import has_access
@@ -454,9 +453,6 @@ class CoursewareIndex(View):
table_of_contents['chapters'],
)
courseware_context['course_sock_fragment'] = CourseSockFragmentView().render_to_fragment(
request, course=self.course)
# entrance exam data
self._add_entrance_exam_to_context(courseware_context)

View File

@@ -66,6 +66,3 @@
// responsive
@import 'base/layouts'; // temporary spot for responsive course
@import 'header';
// features
@import 'features/course-sock';

View File

@@ -28,7 +28,6 @@ $static-path: '../..';
@import 'features/bookmarks';
@import 'features/course-experience';
@import 'features/course-search';
@import 'features/course-sock';
@import 'features/course-upgrade-message';
@import 'features/course-duration-limits';

View File

@@ -1,170 +0,0 @@
.verification-sock {
display: inline-block;
position: relative;
width: 100%;
max-width: map-get($container-max-widths, xl);
margin: $baseline auto 0;
-webkit-transition: all 0.4s ease-out;
-moz-transition: all 0.4s ease-out;
-o-transition: all 0.4s ease-out;
-ms-transition: all 0.4s ease-out;
transition: all 0.4s ease-out;
.action-toggle-verification-sock {
@include left(50%);
@include margin-left(-1 * $baseline * 15/2);
position: absolute;
top: (-1 * $baseline);
width: ($baseline * 15);
color: theme-color("inverse");
background-color: theme-color("success");
border-color: theme-color("success");
background-image: none;
box-shadow: none;
-webkit-transition: background-color 0.5s;
transition: background-color 0.5s;
cursor: pointer;
&.active,
&:focus,
&:hover {
color: theme-color("success");
background-color: theme-color("inverse");
border-color: theme-color("success");
background-image: none;
box-shadow: none;
}
}
.verification-main-panel {
display: none;
overflow: hidden;
border-top: 1px solid $border-color;
padding: ($baseline * 5/2) ($baseline * 2);
-webkit-transition: height ease-out;
transition: height ease-out;
.verification-desc-panel {
color: $black-t3;
position: relative;
h2 {
font-size: 1.5rem;
font-weight: $font-weight-bold;
}
h3 {
font-size: 1.25rem;
}
@media (max-width: 960px) {
.mini-cert {
display: none;
border: 1px solid $black-t0;
}
}
.mini-cert {
@include right($baseline);
position: absolute;
top: $baseline;
width: ($baseline * 13);
}
.learner-story-container {
display: flex;
max-width: 630px;
.student-image {
margin: ($baseline / 4) $baseline 0 0;
height: ($baseline * 5/2);
width: ($baseline * 5/2);
}
.story-quote > .author {
display: block;
margin-top: ($baseline / 4);
font-weight: 600;
}
&:not(:first-child) {
margin-top: ($baseline * 2);
}
}
.action-upgrade-certificate {
position: absolute;
right: $baseline;
background-color: theme-color("success");
border-color: theme-color("success");
color: theme-color("inverse");
background-image: none;
box-shadow: none;
cursor: pointer;
&:hover {
background-color: theme-color("inverse");
color: theme-color("success");
}
@media (max-width: 960px) {
& {
position: relative;
margin-top: ($baseline * 2);
}
}
@media (min-width: 960px) {
&.stuck-top {
bottom: auto;
top: $baseline * (52 / 5);
}
&.stuck-bottom {
top: auto;
bottom: $baseline * (-1 * 3/2);
}
&.attached {
@include right($baseline);
position: fixed;
bottom: $baseline;
top: auto;
}
}
}
}
}
}
// Overrides for the courseware page.
.view-courseware {
.verification-sock {
margin-top: 0;
border-top: none;
border-bottom: none;
.action-toggle-verification-sock {
top: (-1 * $baseline * 5/4);
&:not(.active) {
color: theme-color("inverse");
background-color: theme-color("success");
box-shadow: none;
border: 1px solid theme-color("success");
&:hover {
background-color: $success-color-hover;
}
}
}
.verification-main-panel {
border-top: 0;
border-bottom: 1px solid $border-color;
}
}
}

View File

@@ -290,7 +290,6 @@ ${HTML(fragment.foot_html())}
</section>
</div>
${HTML(course_sock_fragment.body_html())}
</div>
<div class="container-footer">
% if settings.FEATURES.get("LICENSING", False):
@@ -317,36 +316,3 @@ ${HTML(fragment.foot_html())}
% endif
</nav>
% endif
<%static:require_module_async module_name="js/commerce/track_ecommerce_events" class_name="TrackECommerceEvents">
var fbeLink = $("#FBE_banner");
var welcomeLink = $("#welcome");
var accessDeniedUpsellLink = $("#accessDeniedUpsell");
var sockLink = $("#sock");
TrackECommerceEvents.trackUpsellClick(fbeLink, 'in_course_audit_access_expires', {
pageName: "in_course",
linkType: "link",
linkCategory: "FBE_banner"
});
TrackECommerceEvents.trackUpsellClick(welcomeLink, 'in_course_welcome', {
pageName: "in_course",
linkType: "link",
linkCategory: "welcome"
});
TrackECommerceEvents.trackUpsellClick(accessDeniedUpsellLink, 'in_course_upgrade', {
pageName: "in_course",
linkType: "link",
linkCategory: "(none)"
});
TrackECommerceEvents.trackUpsellClick(sockLink, 'in_course_sock', {
pageName: "in_course",
linkType: "button",
linkCategory: "green_upgrade"
});
</%static:require_module_async>