// Package notifyrender owns the subject/body templates used by both the // legacy sender (internal/sender) and the worker-driven notification // producer (internal/notifier). It is a leaf package so the notifier package // can pre-render notification content for the worker without importing the // sender package, which would otherwise create an import cycle (sender's // tests already import notifier to drive the legacy loop). package notifyrender import ( "bytes" "strings" "time" "github.com/russross/blackfriday/v2" "rocketgit.ru/rsmon/worker/app/models" ) const ( stateDown = "down" stateUp = "up" stateTest = "test" stateExp = "exp" ) // GetContent pre-renders subject + bodies for one Message using the same // templates the legacy sender used to apply at delivery time. The result is // what the worker binary consumes directly so it does not need access to // Message/Event rows, workdays, or NotificationDayStart logic on the data plane. // // Returns the four bodies (subject, text, markdown, html). The caller is // responsible for passing them through to the worker task payload. func GetContent(message *models.Message, tn time.Time) (bytes.Buffer, bytes.Buffer, bytes.Buffer, bytes.Buffer) { var subject, textBody, markdownBody, htmlBody bytes.Buffer if message.Kind == stateTest { subject.WriteString("тестовое сообщение от rsmon.ru") textBody.WriteString("тестовое сообщение от rsmon.ru") markdownBody.WriteString("#### тестовое сообщение от rsmon.ru") htmlBody.WriteString("