-
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.
feat: [FC-0047] add settings for edx-ace push notifications
feat: [FC-0047] Add push notifications for user enroll feat: [FC-0047] Add push notifications for user unenroll feat: [FC-0047] Add push notifications for add course beta testers feat: [FC-0047] Add push notifications for remove course beta testers feat: [FC-0047] Add push notification event to discussions
- Loading branch information
1 parent
221e333
commit b325343
Showing
36 changed files
with
380 additions
and
20 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
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
3 changes: 3 additions & 0 deletions
3
lms/djangoapps/discussion/templates/discussion/edx_ace/commentnotification/push/body.txt
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,3 @@ | ||
{% load i18n %} | ||
{% blocktrans trimmed %}{{ comment_username }} commented to {{ thread_title }}:{% endblocktrans %} | ||
{{ comment_body_text }} |
3 changes: 3 additions & 0 deletions
3
lms/djangoapps/discussion/templates/discussion/edx_ace/commentnotification/push/subject.txt
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,3 @@ | ||
{% load i18n %} | ||
|
||
{% blocktrans %}Comment to {{ thread_title }}{% endblocktrans %} |
2 changes: 2 additions & 0 deletions
2
lms/djangoapps/discussion/templates/discussion/edx_ace/responsenotification/push/body.txt
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,2 @@ | ||
{% load i18n %} | ||
{% blocktrans trimmed %}{{ comment_username }} replied to {{ thread_title }}{% endblocktrans %} |
2 changes: 2 additions & 0 deletions
2
lms/djangoapps/discussion/templates/discussion/edx_ace/responsenotification/push/subject.txt
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,2 @@ | ||
{% load i18n %} | ||
{% blocktrans %}Response to {{ thread_title }}{% endblocktrans %} |
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
Empty file.
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,10 @@ | ||
from django.urls import path | ||
from .views import GCMDeviceViewSet | ||
|
||
|
||
CREATE_GCM_DEVICE = GCMDeviceViewSet.as_view({'post': 'create'}) | ||
|
||
|
||
urlpatterns = [ | ||
path('create-token/', CREATE_GCM_DEVICE, name='gcmdevice-list'), | ||
] |
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,50 @@ | ||
from django.conf import settings | ||
from rest_framework import status | ||
from rest_framework.response import Response | ||
|
||
from edx_ace.push_notifications.views import GCMDeviceViewSet as GCMDeviceViewSetBase | ||
|
||
from ..decorators import mobile_view | ||
|
||
|
||
@mobile_view() | ||
class GCMDeviceViewSet(GCMDeviceViewSetBase): | ||
""" | ||
**Use Case** | ||
This endpoint allows clients to register a device for push notifications. | ||
If the device is already registered, the existing registration will be updated. | ||
If setting PUSH_NOTIFICATIONS_SETTINGS is not configured, the endpoint will return a 501 error. | ||
**Example Request** | ||
POST /api/mobile/{version}/notifications/create-token/ | ||
**POST Parameters** | ||
The body of the POST request can include the following parameters. | ||
* name (optional) - A name of the device. | ||
* registration_id (required) - The device token of the device. | ||
* device_id (optional) - ANDROID_ID / TelephonyManager.getDeviceId() (always as hex) | ||
* active (optional) - Whether the device is active, default is True. | ||
If False, the device will not receive notifications. | ||
* cloud_message_type (required) - You should choose FCM or GCM. Currently, only FCM is supported. | ||
* application_id (optional) - Opaque application identity, should be filled in for multiple | ||
key/certificate access. | ||
**Example Response** | ||
```json | ||
{ | ||
"id": 1, | ||
"name": "My Device", | ||
"registration_id": "fj3j4", | ||
"device_id": 1234, | ||
"active": true, | ||
"date_created": "2024-04-18T07:39:37.132787Z", | ||
"cloud_message_type": "FCM", | ||
"application_id": "my_app_id" | ||
} | ||
``` | ||
""" | ||
|
||
def create(self, request, *args, **kwargs): | ||
if not getattr(settings, 'PUSH_NOTIFICATIONS_SETTINGS', None): | ||
return Response('Push notifications are not configured.', status.HTTP_501_NOT_IMPLEMENTED) | ||
|
||
return super().create(request, *args, **kwargs) |
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,5 @@ | ||
{% load i18n %} | ||
{% autoescape off %} | ||
{% blocktrans %}Dear {{ full_name }},{% endblocktrans %} | ||
{% blocktrans %}You have been invited to be a beta tester for {{ course_name }} at {{ site_name }}.{% endblocktrans %} | ||
{% endautoescape %} |
4 changes: 4 additions & 0 deletions
4
lms/templates/instructor/edx_ace/addbetatester/push/subject.txt
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,4 @@ | ||
{% load i18n %} | ||
{% autoescape off %} | ||
{% blocktrans %}You have been invited to a beta test for {{ course_name }} at {{ site_name }}.{% endblocktrans %} | ||
{% endautoescape %} |
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,5 @@ | ||
{% load i18n %} | ||
{% autoescape off %} | ||
{% blocktrans %}Dear student,{% endblocktrans %} | ||
{% blocktrans %}You have been enrolled in {{ course_name }} at {{ site_name }}. This course will now appear on your {{ site_name }} dashboard.{% endblocktrans %} | ||
{% endautoescape %} |
4 changes: 4 additions & 0 deletions
4
lms/templates/instructor/edx_ace/allowedenroll/push/subject.txt
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,4 @@ | ||
{% load i18n %} | ||
{% autoescape off %} | ||
{% blocktrans %}You have been invited to register for {{ course_name }}.{% endblocktrans %} | ||
{% endautoescape %} |
5 changes: 5 additions & 0 deletions
5
lms/templates/instructor/edx_ace/allowedunenroll/push/body.txt
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,5 @@ | ||
{% load i18n %} | ||
{% autoescape off %} | ||
{% blocktrans %}Dear Student,{% endblocktrans %} | ||
{% blocktrans %}You have been unenrolled from the course {{ course_name }}. Please disregard the invitation previously sent.{% endblocktrans %} | ||
{% endautoescape %} |
4 changes: 4 additions & 0 deletions
4
lms/templates/instructor/edx_ace/allowedunenroll/push/subject.txt
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,4 @@ | ||
{% load i18n %} | ||
{% autoescape off %} | ||
{% blocktrans %}You have been unenrolled from {{ course_name }}{% endblocktrans %} | ||
{% endautoescape %} |
5 changes: 5 additions & 0 deletions
5
lms/templates/instructor/edx_ace/enrolledunenroll/push/body.txt
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,5 @@ | ||
{% load i18n %} | ||
{% autoescape off %} | ||
{% blocktrans %}Dear {{ full_name }},{% endblocktrans %} | ||
{% blocktrans %}You have been unenrolled from {{ course_name }} at {{ site_name }}. This course will no longer appear on your {{ site_name }} dashboard.{% endblocktrans %} | ||
{% endautoescape %} |
4 changes: 4 additions & 0 deletions
4
lms/templates/instructor/edx_ace/enrolledunenroll/push/subject.txt
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,4 @@ | ||
{% load i18n %} | ||
{% autoescape off %} | ||
{% blocktrans %}You have been unenrolled from {{ course_name }}{% endblocktrans %} | ||
{% endautoescape %} |
5 changes: 5 additions & 0 deletions
5
lms/templates/instructor/edx_ace/enrollenrolled/push/body.txt
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,5 @@ | ||
{% load i18n %} | ||
{% autoescape off %} | ||
{% blocktrans %}Dear {{ full_name }},{% endblocktrans %} | ||
{% blocktrans %}You have been invited to join {{ course_name }} at {{ site_name }}.{% endblocktrans %} | ||
{% endautoescape %} |
4 changes: 4 additions & 0 deletions
4
lms/templates/instructor/edx_ace/enrollenrolled/push/subject.txt
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,4 @@ | ||
{% load i18n %} | ||
{% autoescape off %} | ||
{% blocktrans %}You have been enrolled in {{ course_name }}{% endblocktrans %} | ||
{% endautoescape %} |
5 changes: 5 additions & 0 deletions
5
lms/templates/instructor/edx_ace/removebetatester/push/body.txt
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,5 @@ | ||
{% load i18n %} | ||
{% autoescape off %} | ||
{% blocktrans %}Dear {{ full_name }},{% endblocktrans %} | ||
{% blocktrans %}You have been removed as a beta tester for {{ course_name }} at {{ site_name }}. This course will remain on your dashboard, but you will no longer be part of the beta testing group.{% endblocktrans %} | ||
{% endautoescape %} |
Oops, something went wrong.