Add daily notification digests

This commit is contained in:
rubenwardy
2020-12-06 15:02:02 +00:00
parent 35e1659b77
commit 3aa12be544
7 changed files with 111 additions and 19 deletions

View File

@@ -348,10 +348,12 @@ class NotificationType(enum.Enum):
else:
return ""
def __str__(self):
return self.name
def __lt__(self, other):
return self.value < other.value
@classmethod
def choices(cls):
return [(choice, choice.getTitle()) for choice in cls]
@@ -397,6 +399,10 @@ class Notification(db.Model):
prefs = self.user.notification_preferences
return prefs and self.user.email and prefs.get_can_email(self.type)
def can_send_digest(self):
prefs = self.user.notification_preferences
return prefs and self.user.email and prefs.get_can_digest(self.type)
class UserNotificationPreferences(db.Model):
id = db.Column(db.Integer, primary_key=True)