MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / init

Function init

pkg/email/templates/user_requested.go:24–43  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22)
23
24func init() {
25 tmpl, err := email.NewTemplateFS(
26 fsys, ttnpb.GetNotificationTypeString(ttnpb.NotificationType_USER_REQUESTED),
27 email.FSTemplate{
28 SubjectTemplate: "A new user has requested to join {{ .Network.Name }}",
29 HTMLTemplateBaseFile: "base.html.tmpl",
30 HTMLTemplateFile: "user_requested.html.tmpl",
31 TextTemplateFile: "user_requested.txt.tmpl",
32 },
33 )
34 if err != nil {
35 panic(err)
36 }
37 email.RegisterTemplate(tmpl)
38 email.RegisterNotification(
39 ttnpb.GetNotificationTypeString(ttnpb.NotificationType_USER_REQUESTED), &email.NotificationBuilder{
40 EmailTemplateName: ttnpb.GetNotificationTypeString(ttnpb.NotificationType_USER_REQUESTED),
41 DataBuilder: newUserRequestedData,
42 })
43}
44
45func newUserRequestedData(_ context.Context, data email.NotificationTemplateData) (email.NotificationTemplateData, error) {
46 var nData ttnpb.CreateUserRequest

Callers

nothing calls this directly

Calls 4

NewTemplateFSFunction · 0.92
RegisterTemplateFunction · 0.92
RegisterNotificationFunction · 0.92

Tested by

no test coverage detected