Skip to content

Commit

Permalink
temp: logs for unsubscribe event (#35652)
Browse files Browse the repository at this point in the history
  • Loading branch information
muhammadadeeltajamul authored Oct 16, 2024
1 parent c3d68b1 commit e28a01e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 4 additions & 0 deletions openedx/core/djangoapps/notifications/email/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
import datetime
import json
import logging

from bs4 import BeautifulSoup
from django.conf import settings
Expand Down Expand Up @@ -31,6 +32,7 @@


User = get_user_model()
log = logging.getLogger(__name__)


def is_email_notification_flag_enabled(user=None):
Expand Down Expand Up @@ -411,4 +413,6 @@ def get_updated_preference(pref):
if pref_value else EmailCadence.NEVER
type_prefs['email_cadence'] = cadence_value
preference.save()
if not user.id:
log.info(f"<Digest-One-Click-Unsubscribe> - user.id is null - {encrypted_username} ")
notification_preference_unsubscribe_event(user)
5 changes: 2 additions & 3 deletions openedx/core/djangoapps/notifications/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,5 @@ def notification_preference_unsubscribe_event(user):
'username': user.username,
'event_type': 'email_digest_unsubscribe'
}
with tracker.get_tracker().context(NOTIFICATION_PREFERENCE_UNSUBSCRIBE, event_data):
tracker.emit(NOTIFICATION_PREFERENCE_UNSUBSCRIBE, event_data)
segment.track(user.id, NOTIFICATION_PREFERENCE_UNSUBSCRIBE, event_data)
tracker.emit(NOTIFICATION_PREFERENCE_UNSUBSCRIBE, event_data)
segment.track(user.id, NOTIFICATION_PREFERENCE_UNSUBSCRIBE, event_data)

0 comments on commit e28a01e

Please sign in to comment.