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

Đang mở
#2,143 0 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@Wikid82 đang làm issue này rồi.

Từ ngày 3/12/2026.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

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.

Ngôn ngữ chính
Go
Star
17
Fork
2
Merge trung bình
1 giờ 42 phút
Pull request đã merge (30 ngày)
173

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Wikid82/Charon

Tất cả issue của Wikid82/Charon

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.