From 828282882066aa4e8bd8fb0c083c530607bc34bb Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 29 Mar 2014 07:50:25 -0400 Subject: Fix action email bug --- modules/base/tool.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'modules/base') diff --git a/modules/base/tool.go b/modules/base/tool.go index d005ffe3..6876da76 100644 --- a/modules/base/tool.go +++ b/modules/base/tool.go @@ -478,6 +478,7 @@ func (a argInt) Get(i int, args ...int) (r int) { type Actioner interface { GetOpType() int GetActUserName() string + GetActEmail() string GetRepoName() string GetBranch() string GetContent() string @@ -520,8 +521,9 @@ type PushCommits struct { // ActionDesc accepts int that represents action operation type // and returns the description. -func ActionDesc(act Actioner, avatarLink string) string { +func ActionDesc(act Actioner) string { actUserName := act.GetActUserName() + email := act.GetActEmail() repoName := act.GetRepoName() repoLink := actUserName + "/" + repoName branch := act.GetBranch() @@ -536,7 +538,7 @@ func ActionDesc(act Actioner, avatarLink string) string { } buf := bytes.NewBuffer([]byte("\n")) for _, commit := range push.Commits { - buf.WriteString(fmt.Sprintf(TPL_COMMIT_REPO_LI, avatarLink, repoLink, commit.Sha1, commit.Sha1[:7], commit.Message) + "\n") + buf.WriteString(fmt.Sprintf(TPL_COMMIT_REPO_LI, AvatarLink(commit.AuthorEmail), repoLink, commit.Sha1, commit.Sha1[:7], commit.Message) + "\n") } if push.Len > 3 { buf.WriteString(fmt.Sprintf(`
%d other commits >>
`, actUserName, repoName, branch, push.Len)) @@ -546,7 +548,7 @@ func ActionDesc(act Actioner, avatarLink string) string { case 6: // Create issue. infos := strings.SplitN(content, "|", 2) return fmt.Sprintf(TPL_CREATE_Issue, actUserName, actUserName, repoLink, infos[0], repoLink, infos[0], - avatarLink, infos[1]) + AvatarLink(email), infos[1]) default: return "invalid type" } -- cgit v1.2.3