diff --git a/lms/djangoapps/mobile_api/notifications/views.py b/lms/djangoapps/mobile_api/notifications/views.py index aeab8c5445c9..4c94ae576e76 100644 --- a/lms/djangoapps/mobile_api/notifications/views.py +++ b/lms/djangoapps/mobile_api/notifications/views.py @@ -7,7 +7,7 @@ from ..decorators import mobile_view -@mobile_view(is_user=True) +@mobile_view() class GCMDeviceViewSet(GCMDeviceViewSetBase): """ **Use Case** diff --git a/lms/templates/instructor/edx_ace/addbetatester/push/body.txt b/lms/templates/instructor/edx_ace/addbetatester/push/body.txt index 9070f05db483..6cd170cd5ce1 100644 --- a/lms/templates/instructor/edx_ace/addbetatester/push/body.txt +++ b/lms/templates/instructor/edx_ace/addbetatester/push/body.txt @@ -1,5 +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 }} by a member of the course staff.{% endblocktrans %} +{% blocktrans %}You have been invited to be a beta tester for {{ course_name }} at {{ site_name }}.{% endblocktrans %} {% endautoescape %} diff --git a/lms/templates/instructor/edx_ace/allowedenroll/push/body.txt b/lms/templates/instructor/edx_ace/allowedenroll/push/body.txt index cddc8d38e29b..fc2e3cce4680 100644 --- a/lms/templates/instructor/edx_ace/allowedenroll/push/body.txt +++ b/lms/templates/instructor/edx_ace/allowedenroll/push/body.txt @@ -1,5 +1,5 @@ {% load i18n %} {% autoescape off %} {% blocktrans %}Dear student,{% endblocktrans %} -{% blocktrans %}You have been invited to join {{ course_name }} at {{ site_name }} by a member of the course staff.{% endblocktrans %} +{% blocktrans %}You have been invited to join {{ course_name }} at {{ site_name }}.{% endblocktrans %} {% endautoescape %} diff --git a/lms/templates/instructor/edx_ace/allowedunenroll/push/body.txt b/lms/templates/instructor/edx_ace/allowedunenroll/push/body.txt index 5981633b96b8..b825ce1d4d18 100644 --- a/lms/templates/instructor/edx_ace/allowedunenroll/push/body.txt +++ b/lms/templates/instructor/edx_ace/allowedunenroll/push/body.txt @@ -1,5 +1,5 @@ {% load i18n %} {% autoescape off %} {% blocktrans %}Dear Student,{% endblocktrans %} -{% blocktrans %}You have been unenrolled from the course {{ course_name }} by a member of the course staff. Please disregard the invitation previously sent.{% endblocktrans %} +{% blocktrans %}You have been unenrolled from the course {{ course_name }}. Please disregard the invitation previously sent.{% endblocktrans %} {% endautoescape %} diff --git a/lms/templates/instructor/edx_ace/enrolledunenroll/push/body.txt b/lms/templates/instructor/edx_ace/enrolledunenroll/push/body.txt index da9c3a3de00c..ce94b24f6167 100644 --- a/lms/templates/instructor/edx_ace/enrolledunenroll/push/body.txt +++ b/lms/templates/instructor/edx_ace/enrolledunenroll/push/body.txt @@ -1,5 +1,5 @@ {% load i18n %} {% autoescape off %} {% blocktrans %}Dear {{ full_name }}{% endblocktrans %} -{% blocktrans %}You have been unenrolled from {{ course_name }} at {{ site_name }} by a member of the course staff. This course will no longer appear on your {{ site_name }} dashboard.{% 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 %} diff --git a/lms/templates/instructor/edx_ace/enrollenrolled/push/body.txt b/lms/templates/instructor/edx_ace/enrollenrolled/push/body.txt index 36bd69d7b72f..883f14770512 100644 --- a/lms/templates/instructor/edx_ace/enrollenrolled/push/body.txt +++ b/lms/templates/instructor/edx_ace/enrollenrolled/push/body.txt @@ -1,5 +1,5 @@ {% load i18n %} {% autoescape off %} {% blocktrans %}Dear {{ full_name }}{% endblocktrans %} -{% blocktrans %}You have been enrolled in {{ course_name }} at {{ site_name }} by a member of the course staff. This course will now appear on your {{ site_name }} dashboard.{% endblocktrans %} +{% blocktrans %}You have been enrolled in {{ course_name }} at {{ site_name }}. This course will now appear on your {{ site_name }} dashboard.{% endblocktrans %} {% endautoescape %} diff --git a/lms/templates/instructor/edx_ace/removebetatester/push/body.txt b/lms/templates/instructor/edx_ace/removebetatester/push/body.txt index 586a9385f988..4806be929b83 100644 --- a/lms/templates/instructor/edx_ace/removebetatester/push/body.txt +++ b/lms/templates/instructor/edx_ace/removebetatester/push/body.txt @@ -1,5 +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 }} by a member of the course staff. This course will remain on your dashboard, but you will no longer be part of the beta testing group.{% 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 %} diff --git a/openedx/core/djangoapps/ace_common/settings/common.py b/openedx/core/djangoapps/ace_common/settings/common.py index 58341470ed8d..dd1d5b680763 100644 --- a/openedx/core/djangoapps/ace_common/settings/common.py +++ b/openedx/core/djangoapps/ace_common/settings/common.py @@ -27,27 +27,24 @@ def plugin_settings(settings): # lint-amnesty, pylint: disable=missing-function settings.FEATURES['test_django_plugin'] = True settings.FCM_APP_NAME = 'fcm-edx-platform' - if getattr(settings, 'FIREBASE_SETUP_STATUS', None) is None: - settings.ACE_CHANNEL_DEFAULT_PUSH = 'push_notification' - - # Note: To local development with Firebase, you must set FIREBASE_CREDENTIALS. - settings.FCM_APP_NAME = 'fcm-edx-platform' - settings.FIREBASE_CREDENTIALS = None - - if firebase_app := setup_firebase_app(settings.FIREBASE_CREDENTIALS, settings.FCM_APP_NAME): - settings.ACE_ENABLED_CHANNELS.append(settings.ACE_CHANNEL_DEFAULT_PUSH) - settings.ACE_ENABLED_POLICIES.append(settings.ACE_CHANNEL_DEFAULT_PUSH) - - settings.PUSH_NOTIFICATIONS_SETTINGS = { - 'CONFIG': 'push_notifications.conf.AppConfig', - 'APPLICATIONS': { - settings.FCM_APP_NAME: { - 'PLATFORM': 'FCM', - 'FIREBASE_APP': firebase_app, - }, + settings.ACE_CHANNEL_DEFAULT_PUSH = 'push_notification' + # Note: To local development with Firebase, you must set FIREBASE_CREDENTIALS. + settings.FCM_APP_NAME = 'fcm-edx-platform' + settings.FIREBASE_CREDENTIALS = None + + settings.FIREBASE_APP = setup_firebase_app(settings.FIREBASE_CREDENTIALS, settings.FCM_APP_NAME) + + if getattr(settings, 'FIREBASE_APP', None): + settings.ACE_ENABLED_CHANNELS.append(settings.ACE_CHANNEL_DEFAULT_PUSH) + settings.ACE_ENABLED_POLICIES.append(settings.ACE_CHANNEL_DEFAULT_PUSH) + + settings.PUSH_NOTIFICATIONS_SETTINGS = { + 'CONFIG': 'push_notifications.conf.AppConfig', + 'APPLICATIONS': { + settings.FCM_APP_NAME: { + 'PLATFORM': 'FCM', + 'FIREBASE_APP': settings.FIREBASE_APP, }, - 'UPDATE_ON_DUPLICATE_REG_ID': True, - } - settings.FIREBASE_SETUP_STATUS = True - else: - settings.FIREBASE_SETUP_STATUS = False + }, + 'UPDATE_ON_DUPLICATE_REG_ID': True, + } diff --git a/openedx/core/djangoapps/ace_common/settings/production.py b/openedx/core/djangoapps/ace_common/settings/production.py index b7ac5b12db17..d3409e13f306 100644 --- a/openedx/core/djangoapps/ace_common/settings/production.py +++ b/openedx/core/djangoapps/ace_common/settings/production.py @@ -27,24 +27,21 @@ def plugin_settings(settings): settings.ACE_CHANNEL_TRANSACTIONAL_EMAIL = settings.ENV_TOKENS.get( 'ACE_CHANNEL_TRANSACTIONAL_EMAIL', settings.ACE_CHANNEL_TRANSACTIONAL_EMAIL ) - settings.FCM_APP_NAME = settings.ENV_TOKENS.get('FCM_APP_NAME', 'fcm-edx-platform') - settings.FIREBASE_CREDENTIALS = settings.ENV_TOKENS.get('FIREBASE_CREDENTIALS', {}) + settings.FCM_APP_NAME = settings.ENV_TOKENS.get('FCM_APP_NAME', settings.FCM_APP_NAME) + settings.FIREBASE_CREDENTIALS = settings.ENV_TOKENS.get('FIREBASE_CREDENTIALS', settings.FIREBASE_CREDENTIALS) - if getattr(settings, 'FIREBASE_SETUP_STATUS', None) is None: - if firebase_app := setup_firebase_app(settings.FIREBASE_CREDENTIALS, settings.FCM_APP_NAME): - settings.ACE_ENABLED_CHANNELS.append(settings.ACE_CHANNEL_DEFAULT_PUSH) - settings.ACE_ENABLED_POLICIES.append(settings.ACE_CHANNEL_DEFAULT_PUSH) + settings.FIREBASE_APP = setup_firebase_app(settings.FIREBASE_CREDENTIALS, settings.FCM_APP_NAME) + if settings.FIREBASE_APP: + settings.ACE_ENABLED_CHANNELS.append(settings.ACE_CHANNEL_DEFAULT_PUSH) + settings.ACE_ENABLED_POLICIES.append(settings.ACE_CHANNEL_DEFAULT_PUSH) - settings.PUSH_NOTIFICATIONS_SETTINGS = { - 'CONFIG': 'push_notifications.conf.AppConfig', - 'APPLICATIONS': { - settings.FCM_APP_NAME: { - 'PLATFORM': 'FCM', - 'FIREBASE_APP': firebase_app, - }, + settings.PUSH_NOTIFICATIONS_SETTINGS = { + 'CONFIG': 'push_notifications.conf.AppConfig', + 'APPLICATIONS': { + settings.FCM_APP_NAME: { + 'PLATFORM': 'FCM', + 'FIREBASE_APP': settings.FIREBASE_APP, }, - 'UPDATE_ON_DUPLICATE_REG_ID': True, - } - settings.FIREBASE_SETUP_STATUS = True - else: - settings.FIREBASE_SETUP_STATUS = False + }, + 'UPDATE_ON_DUPLICATE_REG_ID': True, + } diff --git a/openedx/core/djangoapps/ace_common/utils.py b/openedx/core/djangoapps/ace_common/utils.py index adf5586dc449..508ac4033cd1 100644 --- a/openedx/core/djangoapps/ace_common/utils.py +++ b/openedx/core/djangoapps/ace_common/utils.py @@ -15,6 +15,11 @@ def setup_firebase_app(firebase_credentials, app_name='fcm-app'): except ImportError: log.error('Could not import firebase_admin package.') return + if firebase_credentials: - certificate = firebase_admin.credentials.Certificate(firebase_credentials) - return firebase_admin.initialize_app(certificate, name=app_name) + try: + app = firebase_admin.get_app(app_name) + except ValueError: + certificate = firebase_admin.credentials.Certificate(firebase_credentials) + app = firebase_admin.initialize_app(certificate, name=app_name) + return app diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index 5171438a9519..cfc59346b6c7 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -4,7 +4,7 @@ # # make upgrade # --e git+https://github.com/jazzband/django-push-notifications.git@906fe52058bad36b6af2bb292fdb9292ccaa94e5#egg=django_push_notifications +-e git+https://github.com/jazzband/django-push-notifications.git@0f7918136b5e6a9aec83d6513aad5b0f12143a9f#egg=django_push_notifications # via -r requirements/edx/github.in -e git+https://github.com/raccoongang/edx-ace.git@mob-develop#egg=edx_ace # via @@ -567,7 +567,7 @@ fastavro==1.9.4 # via openedx-events filelock==3.14.0 # via snowflake-connector-python -firebase-admin==5.0.0 +firebase-admin==6.5.0 # via edx-ace frozenlist==1.4.1 # via @@ -946,6 +946,7 @@ pyjwt[crypto]==2.8.0 # edx-drf-extensions # edx-proctoring # edx-rest-api-client + # firebase-admin # pylti1p3 # snowflake-connector-python # social-auth-core diff --git a/requirements/edx/coverage.txt b/requirements/edx/coverage.txt index e150dc3fe238..e41cc829fa37 100644 --- a/requirements/edx/coverage.txt +++ b/requirements/edx/coverage.txt @@ -8,7 +8,7 @@ chardet==5.2.0 # via diff-cover coverage==7.5.1 # via -r requirements/edx/coverage.in -diff-cover==9.0.0 +diff-cover==7.7.0 # via -r requirements/edx/coverage.in jinja2==3.1.4 # via diff-cover diff --git a/requirements/edx/development.txt b/requirements/edx/development.txt index d2b8908dce09..b1e7e3a1242a 100644 --- a/requirements/edx/development.txt +++ b/requirements/edx/development.txt @@ -4,7 +4,7 @@ # # make upgrade # --e git+https://github.com/jazzband/django-push-notifications.git@906fe52058bad36b6af2bb292fdb9292ccaa94e5#egg=django_push_notifications +-e git+https://github.com/jazzband/django-push-notifications.git@0f7918136b5e6a9aec83d6513aad5b0f12143a9f#egg=django_push_notifications # via # -r requirements/edx/doc.txt # -r requirements/edx/testing.txt @@ -351,7 +351,7 @@ defusedxml==0.7.1 # ora2 # python3-openid # social-auth-core -diff-cover==9.0.0 +diff-cover==7.7.0 # via -r requirements/edx/testing.txt dill==0.3.8 # via @@ -926,7 +926,7 @@ filelock==3.14.0 # snowflake-connector-python # tox # virtualenv -firebase-admin==5.0.0 +firebase-admin==6.5.0 # via # -r requirements/edx/doc.txt # -r requirements/edx/testing.txt @@ -1651,6 +1651,7 @@ pyjwt[crypto]==2.8.0 # edx-drf-extensions # edx-proctoring # edx-rest-api-client + # firebase-admin # pylti1p3 # snowflake-connector-python # social-auth-core diff --git a/requirements/edx/doc.txt b/requirements/edx/doc.txt index e1c01186f330..33559d2837a7 100644 --- a/requirements/edx/doc.txt +++ b/requirements/edx/doc.txt @@ -4,7 +4,7 @@ # # make upgrade # --e git+https://github.com/jazzband/django-push-notifications.git@906fe52058bad36b6af2bb292fdb9292ccaa94e5#egg=django_push_notifications +-e git+https://github.com/jazzband/django-push-notifications.git@0f7918136b5e6a9aec83d6513aad5b0f12143a9f#egg=django_push_notifications # via -r requirements/edx/base.txt -e git+https://github.com/raccoongang/edx-ace.git@mob-develop#egg=edx_ace # via -r requirements/edx/base.txt @@ -653,7 +653,7 @@ filelock==3.14.0 # via # -r requirements/edx/base.txt # snowflake-connector-python -firebase-admin==5.0.0 +firebase-admin==6.5.0 # via # -r requirements/edx/base.txt # edx-ace @@ -1137,6 +1137,7 @@ pyjwt[crypto]==2.8.0 # edx-drf-extensions # edx-proctoring # edx-rest-api-client + # firebase-admin # pylti1p3 # snowflake-connector-python # social-auth-core diff --git a/requirements/edx/github.in b/requirements/edx/github.in index 7729b94e1ca3..0d81f31a051d 100644 --- a/requirements/edx/github.in +++ b/requirements/edx/github.in @@ -92,4 +92,4 @@ -e git+https://github.com/anupdhabarde/edx-proctoring-proctortrack.git@31c6c9923a51c903ae83760ecbbac191363aa2a2#egg=edx_proctoring_proctortrack -e git+https://github.com/raccoongang/edx-ace.git@mob-develop#egg=edx_ace --e git+https://github.com/jazzband/django-push-notifications.git@906fe52058bad36b6af2bb292fdb9292ccaa94e5#egg=django_push_notifications +-e git+https://github.com/jazzband/django-push-notifications.git@0f7918136b5e6a9aec83d6513aad5b0f12143a9f#egg=django_push_notifications diff --git a/requirements/edx/testing.txt b/requirements/edx/testing.txt index c255defa15e1..d04dffca0a16 100644 --- a/requirements/edx/testing.txt +++ b/requirements/edx/testing.txt @@ -4,7 +4,7 @@ # # make upgrade # --e git+https://github.com/jazzband/django-push-notifications.git@906fe52058bad36b6af2bb292fdb9292ccaa94e5#egg=django_push_notifications +-e git+https://github.com/jazzband/django-push-notifications.git@0f7918136b5e6a9aec83d6513aad5b0f12143a9f#egg=django_push_notifications # via -r requirements/edx/base.txt -e git+https://github.com/raccoongang/edx-ace.git@mob-develop#egg=edx_ace # via -r requirements/edx/base.txt @@ -267,7 +267,7 @@ defusedxml==0.7.1 # ora2 # python3-openid # social-auth-core -diff-cover==9.0.0 +diff-cover==7.7.0 # via -r requirements/edx/coverage.txt dill==0.3.8 # via pylint @@ -707,7 +707,7 @@ filelock==3.14.0 # snowflake-connector-python # tox # virtualenv -firebase-admin==5.0.0 +firebase-admin==6.5.0 # via # -r requirements/edx/base.txt # edx-ace @@ -1240,6 +1240,7 @@ pyjwt[crypto]==2.8.0 # edx-drf-extensions # edx-proctoring # edx-rest-api-client + # firebase-admin # pylti1p3 # snowflake-connector-python # social-auth-core