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

Aberta
#2,143 0 comentários 0 reações 1 responsável Ver no GitHub

Mantenedores costumam responder em até 1 dia

@Wikid82 já está trabalhando nisso.

Desde 3/12/2026.

Avaliação

Esta issue ainda não foi avaliada.

Descrição

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.

Linguagem predominante
Go
Estrelas
17
Forks
2
Merge médio
1h 42min
PRs com merge (30d)
173

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de Wikid82/Charon

Todas as issues de Wikid82/Charon

Issues semelhantes

Mais issues de Go

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.