-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add custom subject for all kinds of mail templates #27861
base: main
Are you sure you want to change the base?
Conversation
subjectFromTemplate := subjectFromTemplate(string(tpl), data) | ||
if subjectFromTemplate != "" { | ||
subject = subjectFromTemplate | ||
} | ||
data["Subject"] = subject |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we extract this into a new function setSubject
that takes as parameters data, defaultSubject
and always call that instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sense. Will change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Em...Now I think the current way is better.
subject
var is also used in NewMessage(u.Email, subject, content.String())
. If using setSubject
and removing the subject
var, then we should use NewMessage(u.Email, data["Subject"].(string), content.String())
instead. I don't know if it's a good idea to use type assertion in such simple code.
Apply template subject to all mail types (activate account, reset password, etc.).
Follow #8329 (it's in the future enhancement list of that PR but it got forgotten for 4 years)
Fix #27793