Skip to content

Commit 229d233

Browse files
committed
Merge branch 'master' into chris/advanced-editors-iframe
2 parents 57c76fa + 290209b commit 229d233

File tree

81 files changed

+660
-2478
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+660
-2478
lines changed

.github/workflows/pylint-checks.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- module-name: openedx-2
2323
path: "openedx/core/djangoapps/geoinfo/ openedx/core/djangoapps/header_control/ openedx/core/djangoapps/heartbeat/ openedx/core/djangoapps/lang_pref/ openedx/core/djangoapps/models/ openedx/core/djangoapps/monkey_patch/ openedx/core/djangoapps/oauth_dispatch/ openedx/core/djangoapps/olx_rest_api/ openedx/core/djangoapps/password_policy/ openedx/core/djangoapps/plugin_api/ openedx/core/djangoapps/plugins/ openedx/core/djangoapps/profile_images/ openedx/core/djangoapps/programs/ openedx/core/djangoapps/safe_sessions/ openedx/core/djangoapps/schedules/ openedx/core/djangoapps/service_status/ openedx/core/djangoapps/session_inactivity_timeout/ openedx/core/djangoapps/signals/ openedx/core/djangoapps/site_configuration/ openedx/core/djangoapps/system_wide_roles/ openedx/core/djangoapps/theming/ openedx/core/djangoapps/user_api/ openedx/core/djangoapps/user_authn/ openedx/core/djangoapps/util/ openedx/core/djangoapps/verified_track_content/ openedx/core/djangoapps/video_config/ openedx/core/djangoapps/video_pipeline/ openedx/core/djangoapps/waffle_utils/ openedx/core/djangoapps/xblock/ openedx/core/djangoapps/xmodule_django/ openedx/core/tests/ openedx/features/ openedx/testing/ openedx/tests/ openedx/core/djangoapps/notifications/ openedx/core/djangoapps/staticfiles/ openedx/core/djangoapps/content_tagging/"
2424
- module-name: common
25-
path: "common pavelib"
25+
path: "common"
2626
- module-name: cms
2727
path: "cms"
2828
- module-name: xmodule

.github/workflows/unit-test-shards.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -255,15 +255,13 @@
255255
"common-with-lms": {
256256
"settings": "lms.envs.test",
257257
"paths": [
258-
"common/djangoapps/",
259-
"pavelib/"
258+
"common/djangoapps/"
260259
]
261260
},
262261
"common-with-cms": {
263262
"settings": "cms.envs.test",
264263
"paths": [
265-
"common/djangoapps/",
266-
"pavelib/"
264+
"common/djangoapps/"
267265
]
268266
},
269267
"xmodule-with-lms": {

.github/workflows/unit-tests.yml

+12-25
Original file line numberDiff line numberDiff line change
@@ -71,29 +71,17 @@ jobs:
7171

7272
- name: install system requirements
7373
run: |
74-
sudo apt-get update && sudo apt-get install libmysqlclient-dev libxmlsec1-dev lynx openssl
75-
76-
# This is needed until the ENABLE_BLAKE2B_HASHING can be removed and we
77-
# can stop using MD4 by default.
78-
- name: enable md4 hashing in libssl
79-
run: |
80-
cat <<EOF | sudo tee /etc/ssl/openssl.cnf
81-
# Use this in order to automatically load providers.
82-
openssl_conf = openssl_init
83-
84-
[openssl_init]
85-
providers = provider_sect
86-
87-
[provider_sect]
88-
default = default_sect
89-
legacy = legacy_sect
90-
91-
[default_sect]
92-
activate = 1
93-
94-
[legacy_sect]
95-
activate = 1
96-
EOF
74+
sudo apt-get update && sudo apt-get install libmysqlclient-dev libxmlsec1-dev lynx
75+
76+
# Try to log into DockerHub so that we're less likely to be rate-limited when pulling certain images.
77+
# This will fail on any edx-platform fork which doesn't explicitly define its own DockerHub creds.
78+
# That's OK--if we fail to log in, we'll proceed anonymously, and hope we don't get rate-limited.
79+
- name: Try to log into Docker Hub
80+
uses: docker/[email protected]
81+
continue-on-error: true
82+
with:
83+
username: ${{ secrets.DOCKERHUB_USERNAME }}
84+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
9785

9886
- name: Start MongoDB
9987
uses: supercharge/[email protected]
@@ -180,7 +168,7 @@ jobs:
180168
shell: bash
181169
run: |
182170
echo "root_cms_unit_tests_count=$(pytest --disable-warnings --collect-only --ds=cms.envs.test cms/ -q | head -n -2 | wc -l)" >> $GITHUB_ENV
183-
echo "root_lms_unit_tests_count=$(pytest --disable-warnings --collect-only --ds=lms.envs.test lms/ openedx/ common/djangoapps/ xmodule/ pavelib/ -q | head -n -2 | wc -l)" >> $GITHUB_ENV
171+
echo "root_lms_unit_tests_count=$(pytest --disable-warnings --collect-only --ds=lms.envs.test lms/ openedx/ common/djangoapps/ xmodule/ -q | head -n -2 | wc -l)" >> $GITHUB_ENV
184172
185173
- name: get GHA unit test paths
186174
shell: bash
@@ -219,7 +207,6 @@ jobs:
219207
to add any missing apps and match the count. for more details please take a look at scripts/gha-shards-readme.md"
220208
exit 1
221209
222-
223210
# This job aggregates test results. It's the required check for branch protection.
224211
# https://github.com/marketplace/actions/alls-green#why
225212
# https://github.com/orgs/community/discussions/33579

Makefile

+3-4
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ requirements: dev-requirements ## install development environment requirements
9393
# Order is very important in this list: files must appear after everything they include!
9494
REQ_FILES = \
9595
requirements/edx/coverage \
96-
requirements/edx/paver \
9796
requirements/edx-sandbox/base \
9897
requirements/edx/base \
9998
requirements/edx/doc \
@@ -179,7 +178,7 @@ xsslint: ## check xss for quality issuest
179178
--config=scripts.xsslint_config \
180179
--thresholds=scripts/xsslint_thresholds.json
181180

182-
pycodestyle: ## check python files for quality issues
181+
pycodestyle: ## check python files for quality issues
183182
pycodestyle .
184183

185184
## Re-enable --lint flag when this issue https://github.com/openedx/edx-platform/issues/35775 is resolved
@@ -190,13 +189,13 @@ pii_check: ## check django models for pii annotations
190189
--app_name cms \
191190
--coverage \
192191
--lint
193-
192+
194193
DJANGO_SETTINGS_MODULE=lms.envs.test \
195194
code_annotations django_find_annotations \
196195
--config_file .pii_annotations.yml \
197196
--app_name lms \
198197
--coverage \
199-
--lint
198+
--lint
200199

201200
check_keywords: ## check django models for reserve keywords
202201
DJANGO_SETTINGS_MODULE=cms.envs.test \

cms/envs/common.py

-3
Original file line numberDiff line numberDiff line change
@@ -566,9 +566,6 @@
566566
# .. toggle_tickets: https://github.com/openedx/edx-platform/pull/33911
567567
'ENABLE_GRADING_METHOD_IN_PROBLEMS': False,
568568

569-
# See annotations in lms/envs/common.py for details.
570-
'ENABLE_BLAKE2B_HASHING': False,
571-
572569
# .. toggle_name: FEATURES['BADGES_ENABLED']
573570
# .. toggle_implementation: DjangoSetting
574571
# .. toggle_default: False

cms/static/js/views/components/add_library_content.js

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ function($, _, gettext, BaseModal) {
2222
// Translators: "title" is the name of the current component being edited.
2323
titleFormat: gettext('Add library content'),
2424
addPrimaryActionButton: false,
25+
showEditorModeButtons: false,
2526
}),
2627

2728
initialize: function() {

cms/static/js/views/modals/select_v2_library_content.js

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ function($, _, gettext, BaseModal) {
1717
viewSpecificClasses: 'modal-add-component-picker confirm',
1818
titleFormat: gettext('Add library content'),
1919
addPrimaryActionButton: false,
20+
showEditorModeButtons: false,
2021
}),
2122

2223
events: {

cms/static/sass/views/_container.scss

+3
Original file line numberDiff line numberDiff line change
@@ -585,13 +585,16 @@
585585
// cms/static/js/views/components/add_library_content_with_picker.js
586586
.modal-add-component-picker {
587587
top: 10%;
588+
padding: 0px !important;
588589
.modal-content {
589590
padding: 0 !important;
591+
border-radius: ($baseline/5);
590592

591593
& > iframe {
592594
width: 100%;
593595
min-height: 80vh;
594596
background: url('#{$static-path}/images/spinner.gif') center center no-repeat;
597+
border-radius: ($baseline/5);
595598
}
596599
}
597600
}

cms/templates/js/basic-modal.underscore

+15-13
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,22 @@
44
<div class="modal-window-overlay"></div>
55
<div class="modal-window <%- viewSpecificClasses %> modal-<%- size %> modal-type-<%- type %>" tabindex="-1" aria-labelledby="modal-window-title">
66
<div class="<%- name %>-modal">
7-
<div class="modal-header">
8-
<h2 id="modal-window-title" class="title modal-window-title">
9-
<%- title %>
10-
<% if (modalSRTitle) { %>
11-
<span class="sr modal-sr-title">
12-
<%- modalSRTitle %>
13-
</span>
7+
<% if (title || modalSRTitle || showEditorModeButtons) { %>
8+
<div class="modal-header">
9+
<h2 id="modal-window-title" class="title modal-window-title">
10+
<%- title %>
11+
<% if (modalSRTitle) { %>
12+
<span class="sr modal-sr-title">
13+
<%- modalSRTitle %>
14+
</span>
15+
<% } %>
16+
</h2>
17+
<% if (showEditorModeButtons) { %>
18+
<ul class="editor-modes action-list action-modes">
19+
</ul>
1420
<% } %>
15-
</h2>
16-
<% if (showEditorModeButtons) { %>
17-
<ul class="editor-modes action-list action-modes">
18-
</ul>
19-
<% } %>
20-
</div>
21+
</div>
22+
<% } %>
2123
<div class="modal-content">
2224
</div>
2325
<div class="modal-actions">

common/djangoapps/student/models/course_enrollment.py

+2
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,8 @@ def enroll(cls, user, course_key, mode=None, check_access=False, can_upgrade=Fal
717717
Also emits relevant events for analytics purposes.
718718
"""
719719
try:
720+
# .. filter_implemented_name: CourseEnrollmentStarted
721+
# .. filter_type: org.openedx.learning.course.enrollment.started.v1
720722
user, course_key, mode = CourseEnrollmentStarted.run_filter(
721723
user=user, course_key=course_key, mode=mode,
722724
)

common/djangoapps/student/views/management.py

+3
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
from common.djangoapps.student.models import ( # lint-amnesty, pylint: disable=unused-import
7171
AccountRecovery,
7272
CourseEnrollment,
73+
EnrollmentNotAllowed,
7374
PendingEmailChange, # unimport:skip
7475
PendingSecondaryEmailChange,
7576
Registration,
@@ -422,6 +423,8 @@ def change_enrollment(request, check_access=True):
422423
enroll_mode = CourseMode.auto_enroll_mode(course_id, available_modes)
423424
if enroll_mode:
424425
CourseEnrollment.enroll(user, course_id, check_access=check_access, mode=enroll_mode)
426+
except EnrollmentNotAllowed as exc:
427+
return HttpResponseBadRequest(str(exc))
425428
except Exception: # pylint: disable=broad-except
426429
return HttpResponseBadRequest(_("Could not enroll"))
427430

common/djangoapps/util/memcache.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,14 @@
77
import hashlib
88
from urllib.parse import quote_plus
99

10-
from django.conf import settings
1110
from django.utils.encoding import smart_str
1211

1312

1413
def fasthash(string):
1514
"""
1615
Hashes `string` into a string representation of a 128-bit digest.
1716
"""
18-
if settings.FEATURES.get("ENABLE_BLAKE2B_HASHING", False):
19-
hash_obj = hashlib.new("blake2b", digest_size=16)
20-
else:
21-
hash_obj = hashlib.new("md4")
17+
hash_obj = hashlib.new("blake2b", digest_size=16)
2218
hash_obj.update(string.encode('utf-8'))
2319
return hash_obj.hexdigest()
2420

common/djangoapps/util/tests/test_memcache.py

+1-47
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,11 @@
33
"""
44

55

6-
from django.conf import settings
76
from django.core.cache import caches
8-
from django.test import TestCase, override_settings
7+
from django.test import TestCase
98

109
from common.djangoapps.util.memcache import safe_key
1110

12-
BLAKE2B_ENABLED_FEATURES = settings.FEATURES.copy()
13-
BLAKE2B_ENABLED_FEATURES["ENABLE_BLAKE2B_HASHING"] = True
14-
1511

1612
class MemcacheTest(TestCase):
1713
"""
@@ -55,20 +51,6 @@ def test_safe_key_long(self):
5551
# The key should now be valid
5652
assert self._is_valid_key(key), f'Failed for key length {length}'
5753

58-
@override_settings(FEATURES=BLAKE2B_ENABLED_FEATURES)
59-
def test_safe_key_long_with_blake2b_enabled(self):
60-
# Choose lengths close to memcached's cutoff (250)
61-
for length in [248, 249, 250, 251, 252]:
62-
63-
# Generate a key of that length
64-
key = 'a' * length
65-
66-
# Make the key safe
67-
key = safe_key(key, '', '')
68-
69-
# The key should now be valid
70-
assert self._is_valid_key(key), f'Failed for key length {length}'
71-
7254
def test_long_key_prefix_version(self):
7355

7456
# Long key
@@ -83,34 +65,6 @@ def test_long_key_prefix_version(self):
8365
key = safe_key('key', 'prefix', 'a' * 300)
8466
assert self._is_valid_key(key)
8567

86-
@override_settings(FEATURES=BLAKE2B_ENABLED_FEATURES)
87-
def test_long_key_prefix_version_with_blake2b_enabled(self):
88-
89-
# Long key
90-
key = safe_key('a' * 300, 'prefix', 'version')
91-
assert self._is_valid_key(key)
92-
93-
# Long prefix
94-
key = safe_key('key', 'a' * 300, 'version')
95-
assert self._is_valid_key(key)
96-
97-
# Long version
98-
key = safe_key('key', 'prefix', 'a' * 300)
99-
assert self._is_valid_key(key)
100-
101-
def test_safe_key_unicode(self):
102-
103-
for unicode_char in self.UNICODE_CHAR_CODES:
104-
105-
# Generate a key with that character
106-
key = chr(unicode_char)
107-
108-
# Make the key safe
109-
key = safe_key(key, '', '')
110-
111-
# The key should now be valid
112-
assert self._is_valid_key(key), f'Failed for unicode character {unicode_char}'
113-
11468
def test_safe_key_prefix_unicode(self):
11569

11670
for unicode_char in self.UNICODE_CHAR_CODES:
93.8 KB
Binary file not shown.

lms/djangoapps/bulk_email/signals.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""
22
Signal handlers for the bulk_email app
33
"""
4+
import logging
5+
46
from django.dispatch import receiver
57
from eventtracking import tracker
68

@@ -10,6 +12,8 @@
1012

1113
from .models import Optout
1214

15+
log = logging.getLogger(__name__)
16+
1317

1418
@receiver(USER_RETIRE_MAILINGS)
1519
def force_optout_all(sender, **kwargs): # lint-amnesty, pylint: disable=unused-argument
@@ -43,7 +47,7 @@ def ace_email_sent_handler(sender, **kwargs):
4347
if not course_id:
4448
course_email = context.get('course_email', None)
4549
course_id = course_email.course_id if course_email else None
46-
50+
log.info(f'Email sent for {message_name} for course {course_id} using channel {channel}')
4751
tracker.emit(
4852
'edx.ace.message_sent',
4953
{

lms/djangoapps/course_goals/management/commands/goal_reminder_email.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ def handle_goal(goal, today, sunday_date, monday_date, session_id):
284284
'uuid': session_id,
285285
'timestamp': datetime.now(),
286286
'reason': 'User time zone',
287-
'user_timezone': user_timezone,
287+
'user_timezone': str(user_timezone),
288288
'now_in_users_timezone': now_in_users_timezone,
289289
}
290290
)

lms/djangoapps/grades/models.py

-11
Original file line numberDiff line numberDiff line change
@@ -467,12 +467,6 @@ def update_or_create_grade(cls, **params):
467467
defaults=params,
468468
)
469469

470-
# TODO: Remove as part of EDUCATOR-4602.
471-
if str(usage_key.course_key) == 'course-v1:UQx+BUSLEAD5x+2T2019':
472-
log.info('Created/updated grade ***{}*** for user ***{}*** in course ***{}***'
473-
'for subsection ***{}*** with default params ***{}***'
474-
.format(grade, user_id, usage_key.course_key, usage_key, params))
475-
476470
grade.override = PersistentSubsectionGradeOverride.get_override(user_id, usage_key)
477471
if first_attempted is not None and grade.first_attempted is None:
478472
grade.first_attempted = first_attempted
@@ -822,11 +816,6 @@ def update_or_create_override(
822816
grade_defaults['override_reason'] = override_data['comment'] if 'comment' in override_data else None
823817
grade_defaults['system'] = override_data['system'] if 'system' in override_data else None
824818

825-
# TODO: Remove as part of EDUCATOR-4602.
826-
if str(subsection_grade_model.course_id) == 'course-v1:UQx+BUSLEAD5x+2T2019':
827-
log.info('Creating override for user ***{}*** for PersistentSubsectionGrade'
828-
'***{}*** with override data ***{}*** and derived grade_defaults ***{}***.'
829-
.format(requesting_user, subsection_grade_model, override_data, grade_defaults))
830819
try:
831820
override = PersistentSubsectionGradeOverride.objects.get(grade=subsection_grade_model)
832821
for key, value in grade_defaults.items():

lms/djangoapps/grades/rest_api/v1/gradebook_views.py

-5
Original file line numberDiff line numberDiff line change
@@ -859,11 +859,6 @@ def post(self, request, course_key):
859859
subsection = course.get_child(usage_key)
860860
if subsection:
861861
subsection_grade_model = self._create_subsection_grade(user, course, subsection)
862-
# TODO: Remove as part of EDUCATOR-4602.
863-
if str(course_key) == 'course-v1:UQx+BUSLEAD5x+2T2019':
864-
log.info('PersistentSubsectionGrade ***{}*** created for'
865-
' subsection ***{}*** in course ***{}*** for user ***{}***.'
866-
.format(subsection_grade_model, subsection.location, course, user.id))
867862
else:
868863
self._log_update_result(request.user, requested_user_id, requested_usage_id, success=False)
869864
result.append(GradebookUpdateResponseItem(

0 commit comments

Comments
 (0)