-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into mudassir/logo_url_from_backend_for_batch_e…
…nrollment
- Loading branch information
Showing
24 changed files
with
335 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,4 @@ on: | |
jobs: | ||
add_remove_labels: | ||
uses: openedx/.github/.github/workflows/add-remove-label-on-comment.yml@master | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
lms/djangoapps/support/migrations/0006_alter_historicalusersocialauth_extra_data_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Generated by Django 4.2.13 on 2024-06-27 20:46 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('support', '0005_unique_course_id'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='historicalusersocialauth', | ||
name='extra_data', | ||
field=models.JSONField(default=dict), | ||
), | ||
migrations.AlterField( | ||
model_name='historicalusersocialauth', | ||
name='id', | ||
field=models.BigIntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
""" | ||
Tests for DiscussionsConfiguration admin view | ||
""" | ||
from django.test import TestCase | ||
from django.urls import reverse | ||
|
||
from common.djangoapps.student.tests.factories import UserFactory | ||
from openedx.core.djangoapps.discussions.models import DiscussionsConfiguration, Provider | ||
|
||
|
||
class DiscussionsConfigurationAdminTest(TestCase): | ||
""" | ||
Tests for discussion config admin | ||
""" | ||
def setUp(self): | ||
super().setUp() | ||
self.superuser = UserFactory(is_staff=True, is_superuser=True) | ||
self.client.login(username=self.superuser.username, password="Password1234") | ||
|
||
def test_change_view(self): | ||
""" | ||
Test that the DiscussionAdmin's change_view processes the context_key correctly and returns a successful | ||
response. | ||
""" | ||
discussion_config = DiscussionsConfiguration.objects.create( | ||
context_key='course-v1:test+test+06_25_2024', | ||
provider_type=Provider.OPEN_EDX, | ||
) | ||
url = reverse('admin:discussions_discussionsconfiguration_change', args=[discussion_config.context_key]) | ||
response = self.client.get(url) | ||
self.assertEqual(response.status_code, 200) | ||
self.assertContains(response, 'course-v1:test+test+06_25_2024') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
""" | ||
Events for email notifications | ||
""" | ||
import datetime | ||
|
||
from eventtracking import tracker | ||
|
||
from common.djangoapps.track import segment | ||
from openedx.core.djangoapps.notifications.base_notification import COURSE_NOTIFICATION_APPS | ||
|
||
|
||
EMAIL_DIGEST_SENT = "edx.notifications.email_digest" | ||
|
||
|
||
def send_user_email_digest_sent_event(user, cadence_type, notifications): | ||
""" | ||
Sends tracker and segment email for user email digest | ||
""" | ||
notification_breakdown = {key: 0 for key in COURSE_NOTIFICATION_APPS.keys()} | ||
for notification in notifications: | ||
notification_breakdown[notification.app_name] += 1 | ||
event_data = { | ||
"username": user.username, | ||
"email": user.email, | ||
"cadence_type": cadence_type, | ||
"total_notifications_count": len(notifications), | ||
"count_breakdown": notification_breakdown, | ||
"notification_ids": [notification.id for notification in notifications], | ||
"send_at": str(datetime.datetime.now()) | ||
} | ||
with tracker.get_tracker().context(EMAIL_DIGEST_SENT, event_data): | ||
tracker.emit( | ||
EMAIL_DIGEST_SENT, | ||
event_data, | ||
) | ||
segment.track( | ||
'None', | ||
EMAIL_DIGEST_SENT, | ||
event_data, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.