E-Mail-Benachrichtigungen: Lagebild vs. Recherche unterscheiden

Template passt Text je nach incident_type an:
- adhoc: "Neues Lagebild - Benachrichtigung" / "Neuigkeiten zur Lage"
- research: "Recherche - Benachrichtigung" / "Neuigkeiten zur Recherche"

incident_type wird durch die gesamte Notification-Kette durchgereicht.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Dieser Commit ist enthalten in:
Claude Dev
2026-04-09 19:49:59 +02:00
Ursprung ac3fe5f22b
Commit 3356ba1ae5
2 geänderte Dateien mit 12 neuen und 4 gelöschten Zeilen

Datei anzeigen

@@ -320,7 +320,8 @@ async def _create_notifications_for_incident(
async def _send_email_notifications_for_incident( async def _send_email_notifications_for_incident(
db, incident_id: int, incident_title: str, visibility: str, db, incident_id: int, incident_title: str, visibility: str,
created_by: int, tenant_id: int, notifications: list[dict] created_by: int, tenant_id: int, notifications: list[dict],
incident_type: str = "adhoc",
): ):
"""Sendet E-Mail-Benachrichtigungen basierend auf individuellen Nutzer-Abos. """Sendet E-Mail-Benachrichtigungen basierend auf individuellen Nutzer-Abos.
@@ -378,6 +379,7 @@ async def _send_email_notifications_for_incident(
incident_title=incident_title, incident_title=incident_title,
notifications=filtered_notifications, notifications=filtered_notifications,
dashboard_url=dashboard_url, dashboard_url=dashboard_url,
incident_type=incident_type,
) )
try: try:
await send_email(prefs["email"], subject, html) await send_email(prefs["email"], subject, html)
@@ -1342,7 +1344,8 @@ class AgentOrchestrator:
) )
# E-Mail-Benachrichtigungen versenden # E-Mail-Benachrichtigungen versenden
await _send_email_notifications_for_incident( await _send_email_notifications_for_incident(
db, incident_id, title, visibility, created_by, tenant_id, db_notifications db, incident_id, title, visibility, created_by, tenant_id, db_notifications,
incident_type=incident_type,
) )
# Refresh-Log abschließen (mit Token-Statistiken) # Refresh-Log abschließen (mit Token-Statistiken)

Datei anzeigen

@@ -38,6 +38,7 @@ def incident_notification_email(
incident_title: str, incident_title: str,
notifications: list[dict], notifications: list[dict],
dashboard_url: str, dashboard_url: str,
incident_type: str = "adhoc",
) -> tuple[str, str]: ) -> tuple[str, str]:
"""Erzeugt Benachrichtigungs-E-Mail für Lagen-Updates. """Erzeugt Benachrichtigungs-E-Mail für Lagen-Updates.
@@ -46,10 +47,14 @@ def incident_notification_email(
incident_title: Titel der Lage/Recherche incident_title: Titel der Lage/Recherche
notifications: Liste von {"text": ..., "icon": ...} Dicts notifications: Liste von {"text": ..., "icon": ...} Dicts
dashboard_url: Link zum Dashboard dashboard_url: Link zum Dashboard
incident_type: "adhoc" oder "research"
Returns: Returns:
(subject, html_body) (subject, html_body)
""" """
is_research = incident_type == "research"
type_label = "Recherche" if is_research else "Lagebild"
type_label_lower = "Recherche" if is_research else "Lage"
subject = f"AegisSight - {incident_title}" subject = f"AegisSight - {incident_title}"
icon_map = { icon_map = {
@@ -82,10 +87,10 @@ def incident_notification_email(
<body style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #0f172a; color: #e2e8f0; padding: 40px 20px;"> <body style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #0f172a; color: #e2e8f0; padding: 40px 20px;">
<div style="max-width: 480px; margin: 0 auto; background: #1e293b; border-radius: 12px; padding: 32px; border: 1px solid #334155;"> <div style="max-width: 480px; margin: 0 auto; background: #1e293b; border-radius: 12px; padding: 32px; border: 1px solid #334155;">
<h1 style="color: #f0b429; font-size: 20px; margin: 0 0 8px 0;">AegisSight Monitor</h1> <h1 style="color: #f0b429; font-size: 20px; margin: 0 0 8px 0;">AegisSight Monitor</h1>
<p style="color: #94a3b8; font-size: 12px; margin: 0 0 24px 0;">Lagebericht-Benachrichtigung</p> <p style="color: #94a3b8; font-size: 12px; margin: 0 0 24px 0;">{type_label} - Benachrichtigung</p>
<p style="margin: 0 0 8px 0;">Hallo {username},</p> <p style="margin: 0 0 8px 0;">Hallo {username},</p>
<p style="margin: 0 0 20px 0;">es gibt Neuigkeiten zur Lage <strong style="color: #f0b429;">{incident_title}</strong>:</p> <p style="margin: 0 0 20px 0;">es gibt Neuigkeiten zur {type_label_lower} <strong style="color: #f0b429;">{incident_title}</strong>:</p>
<div style="background: #0f172a; border-radius: 8px; padding: 4px 16px; margin: 0 0 24px 0;"> <div style="background: #0f172a; border-radius: 8px; padding: 4px 16px; margin: 0 0 24px 0;">
{items_html} {items_html}