diff options
author | Unknwon <u@gogs.io> | 2017-04-05 09:17:21 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2017-04-05 09:17:21 -0400 |
commit | edaf14f2b6fd86f8dec99f67512a5c0095e391dc (patch) | |
tree | ec81011348a0c8df3995c36b46e2646472106800 /pkg/mailer | |
parent | 6fbb984ebf4f0d6804f0f83e6edb12ef0bb9a570 (diff) |
Refactoring: remove tool.TplName
Diffstat (limited to 'pkg/mailer')
-rw-r--r-- | pkg/mailer/mail.go | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/pkg/mailer/mail.go b/pkg/mailer/mail.go index 09405a2d..273dca6d 100644 --- a/pkg/mailer/mail.go +++ b/pkg/mailer/mail.go @@ -12,21 +12,20 @@ import ( "gopkg.in/gomail.v2" "gopkg.in/macaron.v1" - "github.com/gogits/gogs/pkg/tool" "github.com/gogits/gogs/pkg/markup" "github.com/gogits/gogs/pkg/setting" ) const ( - MAIL_AUTH_ACTIVATE tool.TplName = "auth/activate" - MAIL_AUTH_ACTIVATE_EMAIL tool.TplName = "auth/activate_email" - MAIL_AUTH_RESET_PASSWORD tool.TplName = "auth/reset_passwd" - MAIL_AUTH_REGISTER_NOTIFY tool.TplName = "auth/register_notify" + MAIL_AUTH_ACTIVATE = "auth/activate" + MAIL_AUTH_ACTIVATE_EMAIL = "auth/activate_email" + MAIL_AUTH_RESET_PASSWORD = "auth/reset_passwd" + MAIL_AUTH_REGISTER_NOTIFY = "auth/register_notify" - MAIL_ISSUE_COMMENT tool.TplName = "issue/comment" - MAIL_ISSUE_MENTION tool.TplName = "issue/mention" + MAIL_ISSUE_COMMENT = "issue/comment" + MAIL_ISSUE_MENTION = "issue/mention" - MAIL_NOTIFY_COLLABORATOR tool.TplName = "notify/collaborator" + MAIL_NOTIFY_COLLABORATOR = "notify/collaborator" ) type MailRender interface { @@ -79,7 +78,7 @@ type Issue interface { HTMLURL() string } -func SendUserMail(c *macaron.Context, u User, tpl tool.TplName, code, subject, info string) { +func SendUserMail(c *macaron.Context, u User, tpl, code, subject, info string) { data := map[string]interface{}{ "Username": u.DisplayName(), "ActiveCodeLives": setting.Service.ActiveCodeLives / 60, @@ -172,12 +171,12 @@ func composeTplData(subject, body, link string) map[string]interface{} { return data } -func composeIssueMessage(issue Issue, repo Repository, doer User, tplName tool.TplName, tos []string, info string) *Message { +func composeIssueMessage(issue Issue, repo Repository, doer User, tplName string, tos []string, info string) *Message { subject := issue.MailSubject() body := string(markup.RenderSpecialLink([]byte(issue.Content()), repo.HTMLURL(), repo.ComposeMetas())) data := composeTplData(subject, body, issue.HTMLURL()) data["Doer"] = doer - content, err := mailRender.HTMLString(string(tplName), data) + content, err := mailRender.HTMLString(tplName, data) if err != nil { log.Error(3, "HTMLString (%s): %v", tplName, err) } |