Skip to content

Commit

Permalink
feat(signup): added back the welcome on signup completed email
Browse files Browse the repository at this point in the history
  • Loading branch information
torkelo committed Aug 31, 2015
1 parent d19e101 commit 99bb9d4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ public/css/*.min.css
conf/custom.ini
fig.yml
profile.cov

grafana
16 changes: 16 additions & 0 deletions pkg/services/notifications/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
var mailTemplates *template.Template
var tmplResetPassword = "reset_password.html"
var tmplSignUpStarted = "signup_started.html"
var tmplWelcomeOnSignUp = "welcome_on_signup.html"

func Init() error {
initMailQueue()
Expand All @@ -28,6 +29,7 @@ func Init() error {
bus.AddHandler("email", sendEmailCommandHandler)

bus.AddEventListener(signUpStartedHandler)
bus.AddEventListener(signUpCompletedHandler)

mailTemplates = template.New("name")
mailTemplates.Funcs(template.FuncMap{
Expand Down Expand Up @@ -143,3 +145,17 @@ func signUpStartedHandler(evt *events.SignUpStarted) error {
},
})
}

func signUpCompletedHandler(evt *events.SignUpCompleted) error {
if evt.Email == "" || !setting.Smtp.SendWelcomeEmailOnSignUp {
return nil
}

return sendEmailCommandHandler(&m.SendEmailCommand{
To: []string{evt.Email},
Template: tmplSignUpStarted,
Data: map[string]interface{}{
"Name": evt.Name,
},
})
}

0 comments on commit 99bb9d4

Please sign in to comment.