|
|
@ -478,6 +478,7 @@ func (a argInt) Get(i int, args ...int) (r int) { |
|
|
|
type Actioner interface { |
|
|
|
type Actioner interface { |
|
|
|
GetOpType() int |
|
|
|
GetOpType() int |
|
|
|
GetActUserName() string |
|
|
|
GetActUserName() string |
|
|
|
|
|
|
|
GetActEmail() string |
|
|
|
GetRepoName() string |
|
|
|
GetRepoName() string |
|
|
|
GetBranch() string |
|
|
|
GetBranch() string |
|
|
|
GetContent() string |
|
|
|
GetContent() string |
|
|
@ -520,8 +521,9 @@ type PushCommits struct { |
|
|
|
|
|
|
|
|
|
|
|
// ActionDesc accepts int that represents action operation type
|
|
|
|
// ActionDesc accepts int that represents action operation type
|
|
|
|
// and returns the description.
|
|
|
|
// and returns the description.
|
|
|
|
func ActionDesc(act Actioner, avatarLink string) string { |
|
|
|
func ActionDesc(act Actioner) string { |
|
|
|
actUserName := act.GetActUserName() |
|
|
|
actUserName := act.GetActUserName() |
|
|
|
|
|
|
|
email := act.GetActEmail() |
|
|
|
repoName := act.GetRepoName() |
|
|
|
repoName := act.GetRepoName() |
|
|
|
repoLink := actUserName + "/" + repoName |
|
|
|
repoLink := actUserName + "/" + repoName |
|
|
|
branch := act.GetBranch() |
|
|
|
branch := act.GetBranch() |
|
|
@ -536,7 +538,7 @@ func ActionDesc(act Actioner, avatarLink string) string { |
|
|
|
} |
|
|
|
} |
|
|
|
buf := bytes.NewBuffer([]byte("\n")) |
|
|
|
buf := bytes.NewBuffer([]byte("\n")) |
|
|
|
for _, commit := range push.Commits { |
|
|
|
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 { |
|
|
|
if push.Len > 3 { |
|
|
|
buf.WriteString(fmt.Sprintf(`<div><a href="/%s/%s/commits/%s">%d other commits >></a></div>`, actUserName, repoName, branch, push.Len)) |
|
|
|
buf.WriteString(fmt.Sprintf(`<div><a href="/%s/%s/commits/%s">%d other commits >></a></div>`, actUserName, repoName, branch, push.Len)) |
|
|
@ -546,7 +548,7 @@ func ActionDesc(act Actioner, avatarLink string) string { |
|
|
|
case 6: // Create issue.
|
|
|
|
case 6: // Create issue.
|
|
|
|
infos := strings.SplitN(content, "|", 2) |
|
|
|
infos := strings.SplitN(content, "|", 2) |
|
|
|
return fmt.Sprintf(TPL_CREATE_Issue, actUserName, actUserName, repoLink, infos[0], repoLink, infos[0], |
|
|
|
return fmt.Sprintf(TPL_CREATE_Issue, actUserName, actUserName, repoLink, infos[0], repoLink, infos[0], |
|
|
|
avatarLink, infos[1]) |
|
|
|
AvatarLink(email), infos[1]) |
|
|
|
default: |
|
|
|
default: |
|
|
|
return "invalid type" |
|
|
|
return "invalid type" |
|
|
|
} |
|
|
|
} |
|
|
|