fallback to username if Name field is not set (#996)

* fallback to username if Name field is not set

* add orgname field to invite emails
This commit is contained in:
Victor Vrantchan 2017-01-17 16:37:00 -05:00 committed by GitHub
parent d1a259f4c0
commit 0c93c4db67
2 changed files with 7 additions and 1 deletions

View file

@ -76,6 +76,7 @@ type InviteMailer struct {
*Invite
KolideServerURL template.URL
InvitedByUsername string
OrgName string
}
func (i *InviteMailer) Message() ([]byte, error) {

View file

@ -54,6 +54,10 @@ func (svc service) InviteNewUser(ctx context.Context, payload kolide.InvitePaylo
return nil, err
}
invitedBy := inviter.Name
if invitedBy == "" {
invitedBy = inviter.Username
}
inviteEmail := kolide.Email{
Subject: "You're Invited to Kolide",
To: []string{invite.Email},
@ -61,7 +65,8 @@ func (svc service) InviteNewUser(ctx context.Context, payload kolide.InvitePaylo
Mailer: &kolide.InviteMailer{
Invite: invite,
KolideServerURL: template.URL(config.KolideServerURL),
InvitedByUsername: inviter.Name,
OrgName: config.OrgName,
InvitedByUsername: invitedBy,
},
}