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]
|
if len(emailRecipients) > 0 {
|
||||||
_, err = s.aeroSvc.ShootEmail(ctx, &pbaero.ShootEmailRequest{
|
newMemberEmailPrefix := strings.Split(normalized, "@")[0]
|
||||||
ToEmails: emailRecipients,
|
_, err = s.aeroSvc.ShootEmail(ctx, &pbaero.ShootEmailRequest{
|
||||||
Subject: fmt.Sprintf("A new member has joined %s", network.Name),
|
ToEmails: emailRecipients,
|
||||||
TemplateData: &pbaero.ShootEmailRequest_SimpleHtmlData{
|
Subject: fmt.Sprintf("A new member has joined %s", network.Name),
|
||||||
SimpleHtmlData: &pbaero.SimpleHtmlData{
|
TemplateData: &pbaero.ShootEmailRequest_SimpleHtmlData{
|
||||||
Html: buildNewMemberHTML(network.Name, newMemberEmailPrefix),
|
SimpleHtmlData: &pbaero.SimpleHtmlData{
|
||||||
|
Html: buildNewMemberHTML(network.Name, newMemberEmailPrefix),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
})
|
||||||
})
|
if err != nil {
|
||||||
if err != nil {
|
flog.Warn("unable to send email notification", "email", email, "network", network.Name)
|
||||||
flog.Warn("unable to send email notification", "email", email, "network", network.Name)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user