From 3a05fd20c6cb8ba3c5d5fd517d4b9a9d40ee61c1 Mon Sep 17 00:00:00 2001 From: Attiya Ishaque Date: Tue, 20 Feb 2024 14:03:10 +0500 Subject: [PATCH] refactor: Remove unused code for merchandising 2U LOBs (#34230) --- common/djangoapps/student/toggles.py | 16 -- common/djangoapps/student/views/dashboard.py | 7 +- lms/envs/common.py | 7 - .../js/learner_dashboard/Static2UCallouts.jsx | 214 ------------------ webpack.common.config.js | 1 - 5 files changed, 1 insertion(+), 244 deletions(-) delete mode 100644 lms/static/js/learner_dashboard/Static2UCallouts.jsx diff --git a/common/djangoapps/student/toggles.py b/common/djangoapps/student/toggles.py index 37558a3be510..7bc7feebd364 100644 --- a/common/djangoapps/student/toggles.py +++ b/common/djangoapps/student/toggles.py @@ -6,22 +6,6 @@ # Namespace for student waffle flags. WAFFLE_FLAG_NAMESPACE = 'student' -# Waffle flag to enable 2U Recommendations -# .. toggle_name: student.enable_2u_recommendations -# .. toggle_implementation: WaffleFlag -# .. toggle_default: False -# .. toggle_description: Supports rollout of a POC for 2U recommendations. -# .. toggle_use_cases: temporary -# .. toggle_creation_date: 2022-09-20 -# .. toggle_target_removal_date: None -# .. toggle_warning: None -# .. toggle_tickets: VAN-1094 -ENABLE_2U_RECOMMENDATIONS_ON_DASHBOARD = WaffleFlag(f'{WAFFLE_FLAG_NAMESPACE}.enable_2u_recommendations', __name__) - - -def should_show_2u_recommendations(): - return ENABLE_2U_RECOMMENDATIONS_ON_DASHBOARD.is_enabled() - # Waffle flag to enable course enrollment confirmation email. # .. toggle_name: student.enable_enrollment_confirmation_email diff --git a/common/djangoapps/student/views/dashboard.py b/common/djangoapps/student/views/dashboard.py index 115003921a6a..f729a2aee130 100644 --- a/common/djangoapps/student/views/dashboard.py +++ b/common/djangoapps/student/views/dashboard.py @@ -18,7 +18,6 @@ from edx_django_utils import monitoring as monitoring_utils from edx_django_utils.plugins import get_plugins_view_context from edx_toggles.toggles import WaffleFlag -from ipware.ip import get_client_ip from opaque_keys.edx.keys import CourseKey from openedx_filters.learning.filters import DashboardRenderStarted from pytz import UTC @@ -53,7 +52,7 @@ get_enterprise_learner_portal_context, ) from openedx.features.enterprise_support.utils import is_enterprise_learner -from openedx.core.djangoapps.geoinfo.api import country_code_from_ip + from common.djangoapps.student.api import COURSE_DASHBOARD_PLUGIN_VIEW_NAME from common.djangoapps.student.helpers import cert_info, check_verify_status_by_course, get_resume_urls_for_enrollments from common.djangoapps.student.models import ( @@ -787,9 +786,6 @@ def student_dashboard(request): # lint-amnesty, pylint: disable=too-many-statem if fbe_is_on: enrollments_fbe_is_on.append(course_key) - ip_address = get_client_ip(request)[0] - country_code = country_code_from_ip(ip_address).upper() - context = { 'urls': urls, 'programs_data': programs_data, @@ -844,7 +840,6 @@ def student_dashboard(request): # lint-amnesty, pylint: disable=too-many-statem 'course_info': get_dashboard_course_info(user, course_enrollments), # TODO START: clean up as part of REVEM-199 (END) 'disable_unenrollment': disable_unenrollment, - 'country_code': country_code, # TODO: clean when experiment(Merchandise 2U LOBs - Dashboard) would be stop. [VAN-1097] 'is_enterprise_user': is_enterprise_learner(user), } diff --git a/lms/envs/common.py b/lms/envs/common.py index 0ef257df0023..c28b68be4099 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -5353,13 +5353,6 @@ def _make_locale_paths(settings): # pylint: disable=missing-function-docstring ######################## Settings for cancel retirement in Support Tools ######################## COOL_OFF_DAYS = 14 -URLS_2U_LOBS = { - 'executive_education': 'https://www.edx.org/executive-education', - 'masters_degree': 'https://www.edx.org/masters', - 'bachelors_degree': 'https://www.edx.org/bachelors', - 'boot_camps': 'https://www.edx.org/boot-camps', -} - ############ Settings for externally hosted executive education courses ############ EXEC_ED_LANDING_PAGE = "https://www.getsmarter.com/account" diff --git a/lms/static/js/learner_dashboard/Static2UCallouts.jsx b/lms/static/js/learner_dashboard/Static2UCallouts.jsx deleted file mode 100644 index d6087b3b7a8d..000000000000 --- a/lms/static/js/learner_dashboard/Static2UCallouts.jsx +++ /dev/null @@ -1,214 +0,0 @@ -/* global gettext */ -import React from 'react'; - -class Static2UCallouts extends React.Component { - - constructor(props) { - super(props); - this.state = { - show2uLobs: false, - }; - } - - componentDidMount() { - const optimizely = window["optimizely"] || []; - optimizely.push({ - "type": "user", - "attributes": { - "isEnterpriseUser": this.props.isEnterpriseUser.toString(), - } - }); - optimizely.push({ - type: "page", - pageName: "van_1097_merchandise_2u_lobs_on_dashboard" - }); - const experimentId = '22164741776'; - this.timer = setTimeout(() => { - const selectedVariant = optimizely.get("state").getVariationMap()[experimentId]; - if (selectedVariant?.name === 'dashboard_with_2u_lobs'){ - this.setState({ - show2uLobs: true, - }) - } - }, 500 ); - } - - componentWillUnmount() { - clearTimeout(this.timer); - } - - render() { - return ( - this.state.show2uLobs && ( -
-
-
-

- {gettext('More opportunities for you')} -

{gettext(' to learn')}

- -
-

- {gettext('We\'ve added 500+ learning opportunities to create one of the world\'s most ' - + 'comprehensive free-to-degree online learning platforms.')} -

-
-
- -
- New -
-

- Executive Education -

-
- Short courses to develop leadership skills - -
-
-
- - - -
- -
- New -
-

- Master’s Degrees -

-
- Online degree programs from top universities - -
-
-
- - - -
- -
- New -
-

- Bachelor’s Degrees -

-
- Begin or complete a degree; fully online - -
-
- {this.props.countryCode === 'US' && ( -
- - - -
- )} - {this.props.countryCode === 'US' && ( - -
- New -
-

- Boot Camps -

-
- Intensive, hands-on, project-based training - -
-
- )} -
-
) - ); - } -} - -export { Static2UCallouts }; diff --git a/webpack.common.config.js b/webpack.common.config.js index 075bfcf82783..ac5eae519c32 100644 --- a/webpack.common.config.js +++ b/webpack.common.config.js @@ -102,7 +102,6 @@ module.exports = Merge.smart({ DemographicsCollectionModal: './lms/static/js/demographics_collection/DemographicsCollectionModal.jsx', AxiosJwtTokenService: './lms/static/js/jwt_auth/AxiosJwtTokenService.js', EnterpriseLearnerPortalModal: './lms/static/js/learner_dashboard/EnterpriseLearnerPortalModal.jsx', - Static2UCallouts: './lms/static/js/learner_dashboard/Static2UCallouts.jsx', // Learner Dashboard EntitlementFactory: './lms/static/js/learner_dashboard/course_entitlement_factory.js',