From 6bc11c44504135b232605c932c519901a680d4e1 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Thu, 27 Jul 2017 16:53:02 -0400 Subject: hook: fix email not sent after push (#4430) Turns out mail service was not initialized at all, also mail must be sent in sync in hook mode before program exits. --- pkg/template/template.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'pkg/template') diff --git a/pkg/template/template.go b/pkg/template/template.go index 882be145..f93aca74 100644 --- a/pkg/template/template.go +++ b/pkg/template/template.go @@ -22,11 +22,12 @@ import ( "gopkg.in/editorconfig/editorconfig-core-go.v1" "github.com/gogits/gogs/models" - "github.com/gogits/gogs/pkg/tool" "github.com/gogits/gogs/pkg/markup" "github.com/gogits/gogs/pkg/setting" + "github.com/gogits/gogs/pkg/tool" ) +// TODO: only initialize map once and save to a local variable to reduce copies. func NewFuncMap() []template.FuncMap { return []template.FuncMap{map[string]interface{}{ "GoVer": func() string { @@ -91,13 +92,13 @@ func NewFuncMap() []template.FuncMap { } return str[start:end] }, - "Join": strings.Join, - "EllipsisString": tool.EllipsisString, - "DiffTypeToStr": DiffTypeToStr, - "DiffLineTypeToStr": DiffLineTypeToStr, - "Sha1": Sha1, - "ShortSHA1": tool.ShortSHA1, - "MD5": tool.MD5, + "Join": strings.Join, + "EllipsisString": tool.EllipsisString, + "DiffTypeToStr": DiffTypeToStr, + "DiffLineTypeToStr": DiffLineTypeToStr, + "Sha1": Sha1, + "ShortSHA1": tool.ShortSHA1, + "MD5": tool.MD5, "ActionContent2Commits": ActionContent2Commits, "EscapePound": EscapePound, "RenderCommitMessage": RenderCommitMessage, -- cgit v1.2.3