diff --git a/backend/user/models.py b/backend/user/models.py index aa113389..638b9943 100644 --- a/backend/user/models.py +++ b/backend/user/models.py @@ -48,3 +48,5 @@ def create_or_update_user_profile(sender, instance, created, **kwargs): object exists for that User, it will create one """ Profile.objects.get_or_create(user=instance) + if courses_service := NotificationService.objects.filter(name="COURSES").first(): + courses_service.enabled_users.add(instance) diff --git a/backend/user/notifications.py b/backend/user/notifications.py index 2091516d..e3a004b4 100644 --- a/backend/user/notifications.py +++ b/backend/user/notifications.py @@ -1,5 +1,4 @@ import collections -import os import sys from abc import ABC, abstractmethod @@ -62,11 +61,8 @@ def send_one_notification(self, token, payload): class AndroidNotificationWrapper(NotificationWrapper): def __init__(self): try: - server_key = os.path.join( - os.path.dirname(os.path.dirname(os.path.abspath(__file__))), - "penn-mobile-android-firebase-adminsdk-u9rki-c83fb20713.json", - ) - cred = credentials.Certificate(server_key) + auth_key_path = "/app/secrets/notifications/android/fcm.json" + cred = credentials.Certificate(auth_key_path) firebase_admin.initialize_app(cred) except Exception as e: print(f"Notifications Error: Failed to initialize Firebase client: {e}") @@ -90,9 +86,8 @@ def send_one_notification(self, token, payload): class IOSNotificationWrapper(NotificationWrapper): @staticmethod def get_client(is_dev): - auth_key_path = os.path.join( - os.path.dirname(os.path.dirname(os.path.abspath(__file__))), - f"apns-{'dev' if is_dev else 'prod'}.pem", + auth_key_path = ( + f"/app/secrets/notifications/ios{'/dev/apns-dev' if is_dev else '/prod/apns-prod'}.pem" ) return APNsClient(credentials=auth_key_path, use_sandbox=is_dev) diff --git a/backend/wrapped/tests.py b/backend/wrapped/tests.py deleted file mode 100644 index e69de29b..00000000