Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into jill/collection-delete
Browse files Browse the repository at this point in the history
  • Loading branch information
pomegranited committed Sep 24, 2024
2 parents 1a9f655 + a2e2959 commit a6b0ff0
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ lms/djangoapps/instructor_task/
lms/djangoapps/mobile_api/
openedx/core/djangoapps/credentials @openedx/2U-aperture
openedx/core/djangoapps/credit @openedx/2U-aperture
openedx/core/djangoapps/enrollments/ @openedx/2U-aperture
openedx/core/djangoapps/heartbeat/
openedx/core/djangoapps/oauth_dispatch
openedx/core/djangoapps/user_api/ @openedx/2U-aperture
Expand All @@ -37,8 +38,9 @@ lms/djangoapps/certificates/ @openedx/2U-
# Discovery
common/djangoapps/course_modes/
common/djangoapps/enrollment/
lms/djangoapps/branding/ @openedx/2U-aperture
lms/djangoapps/commerce/
lms/djangoapps/experiments/
lms/djangoapps/experiments/ @openedx/2U-aperture
lms/djangoapps/learner_dashboard/ @openedx/2U-aperture
lms/djangoapps/learner_home/ @openedx/2U-aperture
openedx/features/content_type_gating/
Expand Down
1 change: 1 addition & 0 deletions lms/djangoapps/bulk_email/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ def _send_course_email(entry_id, email_id, to_list, global_email_context, subtas
'course_id': str(course_email.course_id),
'to_list': [user_obj.get('email', '') for user_obj in to_list],
'total_recipients': total_recipients,
'ace_enabled_for_bulk_email': is_bulk_email_edx_ace_enabled(),
}
)
# Exclude optouts (if not a retry):
Expand Down
14 changes: 14 additions & 0 deletions lms/djangoapps/discussion/rest_api/discussions_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,4 +399,18 @@ def clean_thread_html_body(html_body):
for match in html_body.find_all(tag):
match.unwrap()

# Replace tags that are not allowed in email
tags_to_update = [
{"source": "button", "target": "span"},
{"source": "h1", "target": "h4"},
{"source": "h2", "target": "h4"},
{"source": "h3", "target": "h4"},
]
for tag_dict in tags_to_update:
for source_tag in html_body.find_all(tag_dict['source']):
target_tag = html_body.new_tag(tag_dict['target'], **source_tag.attrs)
if source_tag.string:
target_tag.string = source_tag.string
source_tag.replace_with(target_tag)

return str(html_body)
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,29 @@ def test_only_script_tag(self):

result = clean_thread_html_body(html_body)
self.assertEqual(result.strip(), expected_output)

def test_button_tag_replace(self):
"""
Tests that the clean_thread_html_body function replaces the button tag with span tag
"""
# Tests for button replacement tag with text
html_body = '<button class="abc">Button</button>'
expected_output = '<span class="abc">Button</span>'
result = clean_thread_html_body(html_body)
self.assertEqual(result, expected_output)

# Tests button tag replacement without text
html_body = '<button class="abc"></button>'
expected_output = '<span class="abc"></span>'
result = clean_thread_html_body(html_body)
self.assertEqual(result, expected_output)

def test_heading_tag_replace(self):
"""
Tests that the clean_thread_html_body function replaces the h1, h2 and h3 tags with h4 tag
"""
for tag in ['h1', 'h2', 'h3']:
html_body = f'<{tag}>Heading</{tag}>'
expected_output = '<h4>Heading</h4>'
result = clean_thread_html_body(html_body)
self.assertEqual(result, expected_output)
2 changes: 2 additions & 0 deletions openedx/core/djangoapps/content/search/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ def rebuild_index(status_cb: Callable[[str], None] | None = None) -> None:
client.index(temp_index_name).update_distinct_attribute(Fields.usage_key)
# Mark which attributes can be used for filtering/faceted search:
client.index(temp_index_name).update_filterable_attributes([
# Get specific block/collection using combination of block_id and context_key
Fields.block_id,
Fields.block_type,
Fields.context_key,
Fields.org,
Expand Down
4 changes: 2 additions & 2 deletions openedx/core/djangoapps/notifications/base_notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@
'name': 'ora_grade_assigned',
'is_core': False,
'info': '',
'web': False,
'email': False,
'web': True,
'email': True,
'push': False,
'email_cadence': EmailCadence.DAILY,
'non_editable': [],
Expand Down
4 changes: 2 additions & 2 deletions openedx/core/djangoapps/notifications/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ def _expected_api_response(self, course=None):
'info': 'Notifications for submission grading.'
},
'ora_grade_assigned': {
'web': False,
'email': False,
'web': True,
'email': True,
'push': False,
'email_cadence': 'Daily',
'info': ''
Expand Down

0 comments on commit a6b0ff0

Please sign in to comment.