Alerting: Upgrade grafana/alerting to use EmbeddedContents (#99983)
* Upgrade grafana/alerting to include EmbeddedContents for email images
This commit is contained in:
@@ -222,16 +222,26 @@ func (e emailSender) SendWebhook(ctx context.Context, cmd *receivers.SendWebhook
|
||||
}
|
||||
|
||||
func (e emailSender) SendEmail(ctx context.Context, cmd *receivers.SendEmailSettings) error {
|
||||
sendEmailCommand := notifications.SendEmailCommand{
|
||||
To: cmd.To,
|
||||
SingleEmail: cmd.SingleEmail,
|
||||
Template: cmd.Template,
|
||||
Subject: cmd.Subject,
|
||||
Data: cmd.Data,
|
||||
ReplyTo: cmd.ReplyTo,
|
||||
EmbeddedFiles: cmd.EmbeddedFiles,
|
||||
}
|
||||
if len(cmd.EmbeddedContents) > 0 {
|
||||
sendEmailCommand.EmbeddedContents = make([]notifications.EmbeddedContent, len(cmd.EmbeddedContents))
|
||||
for i, ec := range cmd.EmbeddedContents {
|
||||
sendEmailCommand.EmbeddedContents[i] = notifications.EmbeddedContent{
|
||||
Name: ec.Name,
|
||||
Content: ec.Content,
|
||||
}
|
||||
}
|
||||
}
|
||||
return e.ns.SendEmailCommandHandlerSync(ctx, ¬ifications.SendEmailCommandSync{
|
||||
SendEmailCommand: notifications.SendEmailCommand{
|
||||
To: cmd.To,
|
||||
SingleEmail: cmd.SingleEmail,
|
||||
Template: cmd.Template,
|
||||
Subject: cmd.Subject,
|
||||
Data: cmd.Data,
|
||||
ReplyTo: cmd.ReplyTo,
|
||||
EmbeddedFiles: cmd.EmbeddedFiles,
|
||||
},
|
||||
SendEmailCommand: sendEmailCommand,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -27,15 +27,25 @@ func (s sender) SendWebhook(ctx context.Context, cmd *receivers.SendWebhookSetti
|
||||
}
|
||||
|
||||
func (s sender) SendEmail(ctx context.Context, cmd *receivers.SendEmailSettings) error {
|
||||
sendEmailCommand := notifications.SendEmailCommand{
|
||||
To: cmd.To,
|
||||
SingleEmail: cmd.SingleEmail,
|
||||
Template: cmd.Template,
|
||||
Subject: cmd.Subject,
|
||||
Data: cmd.Data,
|
||||
ReplyTo: cmd.ReplyTo,
|
||||
EmbeddedFiles: cmd.EmbeddedFiles,
|
||||
}
|
||||
if len(cmd.EmbeddedContents) > 0 {
|
||||
sendEmailCommand.EmbeddedContents = make([]notifications.EmbeddedContent, len(cmd.EmbeddedContents))
|
||||
for i, ec := range cmd.EmbeddedContents {
|
||||
sendEmailCommand.EmbeddedContents[i] = notifications.EmbeddedContent{
|
||||
Name: ec.Name,
|
||||
Content: ec.Content,
|
||||
}
|
||||
}
|
||||
}
|
||||
return s.ns.SendEmailCommandHandlerSync(ctx, ¬ifications.SendEmailCommandSync{
|
||||
SendEmailCommand: notifications.SendEmailCommand{
|
||||
To: cmd.To,
|
||||
SingleEmail: cmd.SingleEmail,
|
||||
Template: cmd.Template,
|
||||
Subject: cmd.Subject,
|
||||
Data: cmd.Data,
|
||||
ReplyTo: cmd.ReplyTo,
|
||||
EmbeddedFiles: cmd.EmbeddedFiles,
|
||||
},
|
||||
SendEmailCommand: sendEmailCommand,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user