feat: implement daily intervention summary email and unread notification reminders with associated settings and workflow views
This commit is contained in:
parent
387f1ae9d6
commit
34d8e51626
4 changed files with 13 additions and 9 deletions
|
|
@ -255,7 +255,7 @@ class Command(BaseCommand):
|
|||
]
|
||||
body = "\n".join(body_lines)
|
||||
|
||||
from_email = getattr(settings, "DEFAULT_FROM_EMAIL", 'no-reply@streetup.be')
|
||||
from_email = getattr(settings, "DEFAULT_FROM_EMAIL", 'StreetUp no-reply <no-reply@streetup.be>')
|
||||
|
||||
email = EmailMultiAlternatives(
|
||||
subject=subject,
|
||||
|
|
|
|||
|
|
@ -820,7 +820,7 @@ def attempt_status_update(request, intervention, user, new_status, pause_reason=
|
|||
# html_body = render_to_string("emails/new_intervention.html", context)
|
||||
|
||||
|
||||
from_email = getattr(settings, "DEFAULT_FROM_EMAIL", 'no-reply@streetup.be')
|
||||
from_email = getattr(settings, "DEFAULT_FROM_EMAIL", 'StreetUp no-reply <no-reply@streetup.be>')
|
||||
reply_to = []
|
||||
|
||||
# Récupérer les autres pièces jointes déjà liées à l'intervention
|
||||
|
|
@ -1011,7 +1011,7 @@ def attempt_status_update(request, intervention, user, new_status, pause_reason=
|
|||
|
||||
text_body = render_to_string("emails/intervention_canceled.txt", context)
|
||||
|
||||
from_email = getattr(settings, "DEFAULT_FROM_EMAIL", 'no-reply@streetup.be')
|
||||
from_email = getattr(settings, "DEFAULT_FROM_EMAIL", 'StreetUp no-reply <no-reply@streetup.be>')
|
||||
reply_to = []
|
||||
|
||||
existing_attachments = get_intervention_attachments(
|
||||
|
|
@ -1243,7 +1243,7 @@ def send_intervention_reminder(request, intervention_id):
|
|||
|
||||
text_body = render_to_string("emails/intervention_reminder.txt", context)
|
||||
|
||||
from_email = getattr(settings, "DEFAULT_FROM_EMAIL", 'no-reply@streetup.be')
|
||||
from_email = getattr(settings, "DEFAULT_FROM_EMAIL", 'StreetUp no-reply <no-reply@streetup.be>')
|
||||
reply_to = []
|
||||
|
||||
existing_attachments = get_intervention_attachments(
|
||||
|
|
@ -1381,7 +1381,7 @@ def send_intervention_modification(request, intervention_id):
|
|||
|
||||
text_body = render_to_string("emails/intervention_modification.txt", context)
|
||||
|
||||
from_email = getattr(settings, "DEFAULT_FROM_EMAIL", 'no-reply@streetup.be')
|
||||
from_email = getattr(settings, "DEFAULT_FROM_EMAIL", 'StreetUp no-reply <no-reply@streetup.be>')
|
||||
reply_to = []
|
||||
|
||||
existing_attachments = get_intervention_attachments(
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ class Command(BaseCommand):
|
|||
subject = f"[StreetUp] Rappel : {count} notification(s) non lue(s)"
|
||||
|
||||
# Host URL pour les liens
|
||||
domain = getattr(settings, 'SITE_URL', 'http://localhost:8003')
|
||||
domain = (getattr(settings, 'ROOT_URL', '') or getattr(settings, 'SITE_URL', '') or 'http://localhost:8000').rstrip('/')
|
||||
|
||||
lines_text = [
|
||||
f"Bonjour {user.get_full_name() or user.username},\n",
|
||||
|
|
@ -104,7 +104,11 @@ class Command(BaseCommand):
|
|||
n = r.notification
|
||||
created_str = n.created_at.strftime('%d/%m/%Y à %H:%M')
|
||||
sender_str = n.sender.get_full_name() if n.sender else _("Système")
|
||||
link = f"{domain}{n.action_url}" if n.action_url else f"{domain}/notifications/"
|
||||
if n.action_url:
|
||||
action_path = n.action_url if n.action_url.startswith('/') else f"/{n.action_url}"
|
||||
link = f"{domain}{action_path}"
|
||||
else:
|
||||
link = f"{domain}/notifications/"
|
||||
|
||||
lines_text.append(f"- [{n.get_notification_type_display()}] {n.title} (reçue le {created_str} par {sender_str})")
|
||||
lines_text.append(f" Lien: {link}\n")
|
||||
|
|
@ -143,7 +147,7 @@ class Command(BaseCommand):
|
|||
msg = EmailMultiAlternatives(
|
||||
subject=subject,
|
||||
body=text_body,
|
||||
from_email=getattr(settings, 'DEFAULT_FROM_EMAIL', 'noreply@streetup.be'),
|
||||
from_email=getattr(settings, 'DEFAULT_FROM_EMAIL', 'StreetUp no-reply <no-reply@streetup.be>'),
|
||||
to=recipient_emails,
|
||||
)
|
||||
msg.attach_alternative(html_body, "text/html")
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ EMAIL_USE_SSL = True
|
|||
EMAIL_PORT = getenv("EMAIL_PORT")
|
||||
EMAIL_HOST_USER = getenv("EMAIL_HOST_USER")
|
||||
EMAIL_HOST_PASSWORD = getenv("EMAIL_HOST_PASSWORD")
|
||||
DEFAULT_FROM_EMAIL = 'no-reply@streetup.be'
|
||||
DEFAULT_FROM_EMAIL = getenv("DEFAULT_FROM_EMAIL", "StreetUp no-reply <no-reply@streetup.be>")
|
||||
|
||||
# Override email recipients for testing (set to None in production)
|
||||
# If set, all emails will be sent to this address instead of real recipients
|
||||
|
|
|
|||
Loading…
Reference in a new issue