prevent sending email when no recipients
This commit is contained in:
@@ -284,18 +284,20 @@ func (s *serviceImpl) AcceptInvitation(ctx context.Context, networkID, email, hu
|
||||
}
|
||||
}
|
||||
|
||||
newMemberEmailPrefix := strings.Split(normalized, "@")[0]
|
||||
_, err = s.aeroSvc.ShootEmail(ctx, &pbaero.ShootEmailRequest{
|
||||
ToEmails: emailRecipients,
|
||||
Subject: fmt.Sprintf("A new member has joined %s", network.Name),
|
||||
TemplateData: &pbaero.ShootEmailRequest_SimpleHtmlData{
|
||||
SimpleHtmlData: &pbaero.SimpleHtmlData{
|
||||
Html: buildNewMemberHTML(network.Name, newMemberEmailPrefix),
|
||||
if len(emailRecipients) > 0 {
|
||||
newMemberEmailPrefix := strings.Split(normalized, "@")[0]
|
||||
_, err = s.aeroSvc.ShootEmail(ctx, &pbaero.ShootEmailRequest{
|
||||
ToEmails: emailRecipients,
|
||||
Subject: fmt.Sprintf("A new member has joined %s", network.Name),
|
||||
TemplateData: &pbaero.ShootEmailRequest_SimpleHtmlData{
|
||||
SimpleHtmlData: &pbaero.SimpleHtmlData{
|
||||
Html: buildNewMemberHTML(network.Name, newMemberEmailPrefix),
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
flog.Warn("unable to send email notification", "email", email, "network", network.Name)
|
||||
})
|
||||
if err != nil {
|
||||
flog.Warn("unable to send email notification", "email", email, "network", network.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user