From a5173d2fce2792c02726d1aba0c0d701916c0747 Mon Sep 17 00:00:00 2001 From: anish Date: Tue, 11 Jul 2023 20:42:20 +0530 Subject: [PATCH 1/8] Project published notification view and template --- funnel/models/notification_types.py | 17 +++ .../notifications/layout_email.html.jinja2 | 8 +- .../project_published_email.html.jinja2 | 127 ++++++++++++++++++ funnel/views/notifications/__init__.py | 1 + .../project_published_notification.py | 52 +++++++ funnel/views/project.py | 2 + 6 files changed, 203 insertions(+), 4 deletions(-) create mode 100644 funnel/templates/notifications/project_published_email.html.jinja2 create mode 100644 funnel/views/notifications/project_published_notification.py diff --git a/funnel/models/notification_types.py b/funnel/models/notification_types.py index abb32fb09..1536303e7 100644 --- a/funnel/models/notification_types.py +++ b/funnel/models/notification_types.py @@ -32,6 +32,7 @@ 'RegistrationCancellationNotification', 'RegistrationConfirmationNotification', 'ProjectStartingNotification', + 'ProjectPublishedNotification', 'OrganizationAdminMembershipNotification', 'OrganizationAdminMembershipRevokedNotification', ] @@ -153,6 +154,22 @@ class ProjectStartingNotification( # This is a notification triggered without an actor +class ProjectPublishedNotification( + DocumentHasProfile, Notification, type='project_published' +): + """Notifications of a newly published project.""" + + category = notification_categories.participant + title = __("When a project is published") + description = __( + "Notifies all members of a profile when a new project is published" + ) + + document_model = Project + roles = ['project_crew', 'project_participant', 'account_participant'] + exclude_actor = False # Send to everyone including the actor + + # --- Comment notifications ------------------------------------------------------------ diff --git a/funnel/templates/notifications/layout_email.html.jinja2 b/funnel/templates/notifications/layout_email.html.jinja2 index 1c5a92003..6ff796e11 100644 --- a/funnel/templates/notifications/layout_email.html.jinja2 +++ b/funnel/templates/notifications/layout_email.html.jinja2 @@ -346,7 +346,7 @@
@@ -356,9 +356,9 @@ 1. max-width for all clients except Desktop Windows Outlook, allowing the email to squish on narrow but never go wider than 600px. 2. MSO tags for Desktop Windows Outlook enforce a 600px width. #} -