fix: notification template preview and editor starter text disagree with what is actually sent

Offen
#2,143 0 Kommentare 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@Wikid82 arbeitet bereits daran.

Seit 03.12.2026.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Beschreibung

backend bug frontend

What

The template preview and the editor's starter text use different variables from the send path.

Where

  • backend/internal/services/notification_service.go RenderTemplate renders against a flat map (used by notification_provider_handler.go Preview and notification_template_handler.go).
  • Sending uses the Hermes renderer, whose data is only Title, Message, Time, EventType and Data.
  • frontend/src/pages/Notifications.tsx:315 fills the editor with {{.HostName}}, {{.HostIP}}, {{.ServiceCount}}, {{.Services}}.

Evidence

  • With the Hermes webhook.RenderPreview, {{.HostName}} and {{.Timestamp}} render as <no value>; unquoted missing values make invalid JSON.
  • From reading the code: a working send template such as {{toJSON (index .Data "HostName")}} would fail in Preview, because the flat map has no Data key.

Severity

Medium.

Suggested approach

Make Preview use the same renderer and data shape as sending, and update the editor starter text to match.

Found while working on #2141.

Vorherrschende Sprache
Go
Sterne
17
Forks
2
Ø Merge
1 Std. 42 Min.
Gemergte PRs (30 T.)
173

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus Wikid82/Charon

Alle Issues in Wikid82/Charon

Ähnliche Issues

Weitere Issues zu Go

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.