forked from openedx/edx-platform
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add email cadence setting in notification preferences for emails
- Loading branch information
1 parent
1968d8f
commit 0270809
Showing
9 changed files
with
178 additions
and
35 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
35 changes: 35 additions & 0 deletions
35
openedx/core/djangoapps/notifications/email_notifications.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,35 @@ | ||
""" | ||
Email notifications module. | ||
""" | ||
from django.utils.translation import gettext_lazy as _ | ||
|
||
|
||
class EmailCadence: | ||
""" | ||
Email cadence class | ||
""" | ||
DAILY = 'Daily' | ||
WEEKLY = 'Weekly' | ||
INSTANTLY = 'Instantly' | ||
NEVER = 'Never' | ||
EMAIL_CADENCE_CHOICES = [ | ||
(DAILY, _('Daily')), | ||
(WEEKLY, _('Weekly')), | ||
(INSTANTLY, _('Instantly')), | ||
(NEVER, _('Never')), | ||
] | ||
EMAIL_CADENCE_CHOICES_DICT = dict(EMAIL_CADENCE_CHOICES) | ||
|
||
@classmethod | ||
def get_email_cadence_choices(cls): | ||
""" | ||
Returns email cadence choices. | ||
""" | ||
return cls.EMAIL_CADENCE_CHOICES | ||
|
||
@classmethod | ||
def get_email_cadence_value(cls, email_cadence): | ||
""" | ||
Returns email cadence display for the given email cadence. | ||
""" | ||
return cls.EMAIL_CADENCE_CHOICES_DICT.get(email_cadence, None) |
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
Oops, something went wrong.