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

Release 0.96.2 #2251

Merged
merged 10 commits into from
Jun 17, 2024
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
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ repos:
- id: yamllint
args: [--format, parsable, -d, relaxed]
- repo: https://github.com/Yelp/detect-secrets
rev: v1.4.0
rev: v1.5.0
hooks:
- id: detect-secrets
args:
Expand All @@ -44,7 +44,7 @@ repos:
- --exclude-files
- ".*_test.js"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.4.1"
rev: "v0.4.8"
hooks:
- id: ruff-format
- id: ruff
Expand All @@ -57,7 +57,7 @@ repos:
- id: shellcheck
args: ["--severity=warning"]
- repo: https://github.com/rhysd/actionlint
rev: v1.6.27
rev: v1.7.1
hooks:
- id: actionlint
name: actionlint
Expand Down
6 changes: 3 additions & 3 deletions .secrets.baseline
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.4.0",
"version": "1.5.0",
"plugins_used": [
{
"name": "ArtifactoryDetector"
Expand Down Expand Up @@ -148,7 +148,7 @@
"filename": "docker-compose.yml",
"hashed_secret": "965748b380ab0ab25d1846afc174a3d93a8ec06c",
"is_verified": false,
"line_number": 17
"line_number": 8
}
],
"frontend/public/src/constants.js": [
Expand Down Expand Up @@ -240,5 +240,5 @@
}
]
},
"generated_at": "2024-05-22T12:17:57Z"
"generated_at": "2024-06-11T15:28:43Z"
}
13 changes: 13 additions & 0 deletions RELEASE.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
Release Notes
=============

Version 0.96.2
--------------

- important enroll color on hover (#2250)
- fix (#2247)
- Remove FacultyBlock class (#2248)
- Update with saved data (#2243)
- Filter relevant course runs to be live (#2244)
- [pre-commit.ci] pre-commit autoupdate (#2191)
- Update color of disabled enroll button (#2239)
- Tech Debt: Remove feature flags that are no longer in use (#2222)
- 4244: no error message is shown when education level is not specified in additional details modal (#2233)

Version 0.96.1 (Released June 05, 2024)
--------------

Expand Down
2 changes: 1 addition & 1 deletion authentication/pipeline/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def create_user_via_email(
"username": f"The username '{username}' is already taken. Please try a different username."
},
)
except Exception as exc: # noqa: BLE001
except Exception as exc:
raise UserCreationFailedException(backend, current_partial) from exc

return {"is_new": True, "user": created_user, "username": created_user.username}
Expand Down
15 changes: 0 additions & 15 deletions cms/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from django.apps import apps
from django.core.exceptions import ValidationError
from wagtail import blocks
from wagtail.images.blocks import ImageChooserBlock


class ResourceBlock(blocks.StructBlock):
Expand All @@ -33,20 +32,6 @@ class PriceBlock(blocks.StructBlock):
)


class FacultyBlock(blocks.StructBlock):
"""
Block class that defines a faculty member
"""

name = blocks.CharBlock(max_length=100, help_text="Name of the faculty member.")
image = ImageChooserBlock(
help_text="Profile image size must be at least 300x300 pixels."
)
description = blocks.RichTextBlock(
help_text="A brief description about the faculty member."
)


class CourseRunFieldBlock(blocks.FieldBlock):
"""
Block class that allows selecting a course run
Expand Down
40 changes: 3 additions & 37 deletions cms/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
SIGNATORY_INDEX_SLUG,
)
from cms.forms import CertificatePageForm
from courses.api import get_user_relevant_course_run, get_user_relevant_course_run_qset
from courses.api import get_relevant_course_run, get_relevant_course_run_qset
from courses.models import (
Course,
CourseRun,
Expand Down Expand Up @@ -829,26 +829,6 @@ def get_context(self, request, *args, **kwargs): # noqa: ARG002
request.session["anonymous_session_id"] = str(uuid.uuid4())
user = request.session["anonymous_session_id"]

show_new_featured_carousel = is_enabled(
features.ENABLE_NEW_HOME_PAGE_FEATURED,
False, # noqa: FBT003
user,
)
show_new_design_hero = is_enabled(
features.ENABLE_NEW_HOME_PAGE_HERO,
False, # noqa: FBT003
user,
)
show_home_page_video_component = is_enabled(
features.ENABLE_NEW_HOME_PAGE_VIDEO,
False, # noqa: FBT003
user,
)
show_home_page_contact_form = is_enabled(
features.ENABLE_NEW_HOME_PAGE_CONTACT_FORM,
False, # noqa: FBT003
user,
)
show_auto_daily_featured_items = is_enabled(
features.ENABLE_AUTO_DAILY_FEATURED_ITEMS,
False, # noqa: FBT003
Expand All @@ -867,10 +847,6 @@ def get_context(self, request, *args, **kwargs): # noqa: ARG002
**get_base_context(request),
"product_cards_section_title": self.product_section_title,
"products": products,
"show_new_featured_carousel": show_new_featured_carousel,
"show_new_design_hero": show_new_design_hero,
"show_home_page_video_component": show_home_page_video_component,
"show_home_page_contact_form": show_home_page_contact_form,
"hubspot_portal_id": hubspot_portal_id,
"hubspot_home_page_form_guid": hubspot_home_page_form_guid,
"show_auto_daily_featured_items": show_auto_daily_featured_items,
Expand Down Expand Up @@ -1227,17 +1203,8 @@ def get_admin_display_title(self):
return f"{self.course.readable_id} | {self.title}"

def get_context(self, request, *args, **kwargs):
relevant_run = get_user_relevant_course_run(
course=self.product, user=request.user
)
relevant_runs = list(
get_user_relevant_course_run_qset(course=self.product, user=request.user)
)
is_enrolled = (
False
if (relevant_run is None or not request.user.is_authenticated)
else (relevant_run.enrollments.filter(user_id=request.user.id).exists())
)
relevant_run = get_relevant_course_run(course=self.product)
relevant_runs = list(get_relevant_course_run_qset(course=self.product))
sign_in_url = (
None
if request.user.is_authenticated
Expand All @@ -1260,7 +1227,6 @@ def get_context(self, request, *args, **kwargs):
**get_base_context(request),
"run": relevant_run,
"course_runs": relevant_runs,
"is_enrolled": is_enrolled,
"sign_in_url": sign_in_url,
"start_date": start_date,
"can_access_edx_course": can_access_edx_course,
Expand Down
20 changes: 2 additions & 18 deletions cms/models_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from django.urls import resolve
from mitol.common.factories import UserFactory
from mitol.common.utils.datetime import now_in_utc
from mitol.olposthog.features import is_enabled

from cms.api import create_featured_items
from cms.constants import CMS_EDITORS_GROUP_NAME
Expand Down Expand Up @@ -48,7 +47,6 @@
from flexiblepricing.constants import FlexiblePriceStatus
from flexiblepricing.factories import FlexiblePriceFactory, FlexiblePriceTierFactory
from flexiblepricing.models import FlexiblePrice
from main import features

pytestmark = [pytest.mark.django_db]

Expand Down Expand Up @@ -161,7 +159,6 @@ def test_course_page_context( # noqa: PLR0913
"request": request,
"run": run,
"course_runs": relevant_runs,
"is_enrolled": exp_is_enrolled,
"sign_in_url": f"/signin/?next={quote_plus(course_page.get_url())}"
if exp_sign_in_url
else None,
Expand All @@ -175,16 +172,6 @@ def test_course_page_context( # noqa: PLR0913
member.linked_instructor_page
for member in course_page.linked_instructors.order_by("order").all()
],
"new_design": is_enabled(
"mitxonline-new-product-page",
False, # noqa: FBT003
request.user.id if request.user.is_authenticated else "anonymousUser",
),
"new_footer": is_enabled(
"mitxonline-new-footer",
False, # noqa: FBT003
request.user.id if request.user.is_authenticated else "anonymousUser",
),
}

context = course_page.get_context(request=request)
Expand Down Expand Up @@ -228,7 +215,7 @@ def test_course_page_context_edx_access( # noqa: PLR0913
)
)
patched_get_relevant_run = mocker.patch(
"cms.models.get_user_relevant_course_run", return_value=run
"cms.models.get_relevant_course_run", return_value=run
)
if not is_authed: # noqa: SIM108
request_user = AnonymousUser()
Expand All @@ -243,9 +230,7 @@ def test_course_page_context_edx_access( # noqa: PLR0913
request.user = request_user
context = course_page.get_context(request=request)
assert context["can_access_edx_course"] is exp_can_access
patched_get_relevant_run.assert_called_once_with(
course=course_page.course, user=request_user
)
patched_get_relevant_run.assert_called_once_with(course=course_page.course)


def generate_flexible_pricing_response(request_user, flexible_pricing_form):
Expand Down Expand Up @@ -688,7 +673,6 @@ def test_flexible_pricing_request_form_context(flex_form_for_course):


def test_homepage__featured_products(settings, mocker):
settings.FEATURES[features.ENABLE_NEW_DESIGN] = True
now = now_in_utc()
future_date = now + timedelta(days=1)
past_date = now - timedelta(days=1)
Expand Down
2 changes: 1 addition & 1 deletion cms/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def call_fastly_purge_api(relative_url):

api_url = urljoin(MITX_ONLINE_FASTLY_URL, relative_url)

resp = requests.request("PURGE", api_url, headers=headers)
resp = requests.request("PURGE", api_url, headers=headers) # noqa: S113

if resp.status_code >= 400: # noqa: PLR2004
logger.error(f"Fastly API Purge call failed: {resp.status_code} {resp.reason}") # noqa: G004
Expand Down
61 changes: 4 additions & 57 deletions cms/templates/home_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@

{% block title %}{{ site_name }}{% endblock %}

{% block bodyclass %}{% if show_new_design_hero or show_new_featured_carousel or show_home_page_video_component %}new-design{% endif %}{% endblock %}
{% block bodyclass %}new-design{% endblock %}

{% block content %}
{% if show_new_design_hero %}
<div class="home-page-hero-row d-flex justify-content-md-center align-items-md-center">
<div class="home-page-hero hero-container col-12">
<div class="home-page-hero-overlay container hero-content">
Expand All @@ -28,21 +27,6 @@ <h2>Open Online Courses - from MIT</h2>
</div>
</div>
</div>
{% else %}
<div id="main" class="hero-container" style="background-image: url('{% wagtail_img_src page.hero%}')">
<div class="container hero-content">
<div class="hero-title">
{% if page.hero_title %}
<h2>{{ page.hero_title }}</h2>
{% endif %}
{% if page.hero_subtitle %}
<h3>{{ page.hero_subtitle }}</h3>
{% endif %}
</div>
</div>
</div>
{% endif %}
{% if show_new_featured_carousel %}
<div class="featured-product-section-container d-flex flex-column container">
<div class="featured-product-section d-flex row" id="featuredProductCarousel">
<div class="featured-product-header d-flex row col-12">
Expand Down Expand Up @@ -70,46 +54,12 @@ <h3 class="featured-product-header-title col-8">{{ product_cards_section_title }
</div>
</div>
</div>
{% else %}
<div class="course-section">
<div class="container">
{% if product_cards_section_title %}
<h1>{{ product_cards_section_title }}</h1>
{% endif %}
<ul class="course-listing card-listing">
{% for product in products %}
{% if not product.is_program %}
<li>
<div class="course-card highlight-card clickable">
<a href="{{ product.url_path }}" class="course-card-link">
<img src="{% feature_img_src product.feature_image %}" alt="">
<div class="course-info">
<h2 class="course-card-title">
{{ product.title }}
</h2>
<div class="course-card-description">
{{ product.description | richtext }}
</div>
{% if product.start_date %}
<span class="date">
Start date: {{ product.start_date | date:"F j, Y" }}
</span>
{% endif %}
</div>
</a>
</div>
</li>
{% endif %}
{% endfor %}
</ul>
</div>
</div>
{% endif %}
{% if show_home_page_video_component and page.video_component_title %}
<div class="home-page-video-row d-flex justify-content-center container">
<div class="home-page-video-container row">
<div class="home-page-video-description col-12 col-xl-5">
<h3>{{ page.video_component_title }}</h3>
{% if page.video_component_title %}
<h3>{{ page.video_component_title }}</h3>
{% endif %}
{{ page.video_component_description|richtext }}
</div>
<div class="home-page-video-wrapper col-12 col-xl-7">
Expand All @@ -127,8 +77,6 @@ <h3>{{ page.video_component_title }}</h3>
</div>
</div>
</div>
{% endif %}
{% if show_home_page_contact_form %}
<div class="home-page-contact-row">
<div class="home-page-contact-row-container">
<div class="home-page-contact-col">
Expand Down Expand Up @@ -199,5 +147,4 @@ <h3>Connect with us</h3>
</div>
</div>
</div>
{% endif %}
{% endblock %}
2 changes: 1 addition & 1 deletion cms/templates/product_page.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "base.html" %}
{% block bodyclass %}{% if new_design %}new-design{% endif %}{% endblock %}
{% block bodyclass %}new-design{% endblock %}

{% load static wagtail_img_src feature_img_src %}
{% load wagtailcore_tags wagtailembeds_tags wagtailmetadata_tags %}
Expand Down
Loading
Loading