Skip to content

Commit ae98b96

Browse files
add is_digest_type property
1 parent 53d2430 commit ae98b96

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

osf/models/notification_type.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,28 @@ def instance(self):
151151
obj, created = NotificationType.objects.get_or_create(name=self.value)
152152
return obj
153153

154+
@property
155+
def is_digest_type(self):
156+
digest_types = {
157+
NotificationType.Type.USER_DIGEST.value,
158+
NotificationType.Type.DIGEST_REVIEWS_MODERATORS.value,
159+
NotificationType.Type.ADDON_FILE_RENAMED.value,
160+
NotificationType.Type.ADDON_FILE_COPIED.value,
161+
NotificationType.Type.FILE_ADDED.value,
162+
NotificationType.Type.ADDON_FILE_MOVED.value,
163+
NotificationType.Type.FILE_REMOVED.value,
164+
NotificationType.Type.FILE_UPDATED.value,
165+
NotificationType.Type.FOLDER_CREATED.value,
166+
NotificationType.Type.USER_FILE_UPDATED.value,
167+
NotificationType.Type.NODE_FILE_UPDATED.value,
168+
NotificationType.Type.PROVIDER_NEW_PENDING_SUBMISSIONS.value,
169+
NotificationType.Type.PROVIDER_NEW_PENDING_WITHDRAW_REQUESTS.value,
170+
NotificationType.Type.COLLECTION_SUBMISSION_SUBMITTED.value,
171+
NotificationType.Type.PROVIDER_REVIEWS_SUBMISSION_CONFIRMATION.value,
172+
NotificationType.Type.REVIEWS_SUBMISSION_STATUS.value,
173+
}
174+
return self.name in digest_types
175+
154176
notification_interval_choices = ArrayField(
155177
base_field=models.CharField(max_length=32),
156178
default=get_default_frequency_choices,

0 commit comments

Comments
 (0)