From 94390236fd75c2b1f70519bc2e44f70e00b8a81b Mon Sep 17 00:00:00 2001 From: Reed Garmsen Date: Mon, 22 Jun 2015 12:25:46 -0700 Subject: [PATCH 1/2] Unescaped escape characters in the subject line of emails so that all characters appear properly --- utils/mail.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/mail.go b/utils/mail.go index 2fb7f801d5..3cd37ffef8 100644 --- a/utils/mail.go +++ b/utils/mail.go @@ -11,6 +11,7 @@ import ( "net" "net/mail" "net/smtp" + "html" ) func CheckMailSettings() *model.AppError { @@ -84,7 +85,7 @@ func SendMail(to, subject, body string) *model.AppError { headers := make(map[string]string) headers["From"] = fromMail.String() headers["To"] = toMail.String() - headers["Subject"] = subject + headers["Subject"] = html.UnescapeString(subject) headers["MIME-version"] = "1.0" headers["Content-Type"] = "text/html" From 6cfccf63d5e3c7cf3a8ff8795c8f1e63e63cfbf0 Mon Sep 17 00:00:00 2001 From: Reed Garmsen Date: Mon, 29 Jun 2015 09:42:12 -0700 Subject: [PATCH 2/2] Changed invite email to reflect the sender's status in the team (e.g. admin v.s. plain member) --- api/team.go | 9 +++++++++ api/templates/invite_body.html | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/api/team.go b/api/team.go index 775bc29ae2..24b7ec9e1a 100644 --- a/api/team.go +++ b/api/team.go @@ -488,12 +488,21 @@ func InviteMembers(team *model.Team, user *model.User, invites []string) { } else { sender = user.FullName } + + senderRole := "" + if strings.Contains(user.Roles, model.ROLE_ADMIN) || strings.Contains(user.Roles, model.ROLE_SYSTEM_ADMIN) { + senderRole = "administrator" + } else { + senderRole = "member" + } + subjectPage := NewServerTemplatePage("invite_subject", teamUrl) subjectPage.Props["SenderName"] = sender subjectPage.Props["TeamName"] = team.Name bodyPage := NewServerTemplatePage("invite_body", teamUrl) bodyPage.Props["TeamName"] = team.Name bodyPage.Props["SenderName"] = sender + bodyPage.Props["SenderStatus"] = senderRole bodyPage.Props["Email"] = invite diff --git a/api/templates/invite_body.html b/api/templates/invite_body.html index 06f48759cf..8be2ac0df2 100644 --- a/api/templates/invite_body.html +++ b/api/templates/invite_body.html @@ -18,7 +18,7 @@

You've been invited

-

{{.Props.TeamName}} started using {{.SiteName}}.
The team administrator {{.Props.SenderName}}, has invited you to join {{.Props.TeamName}}.

+

{{.Props.TeamName}} started using {{.SiteName}}.
The team {{.Props.SenderStatus}} {{.Props.SenderName}}, has invited you to join {{.Props.TeamName}}.

Join Team