aboutsummaryrefslogtreecommitdiff
path: root/models/action.go
diff options
context:
space:
mode:
authorFuXiaoHei <fuxiaohei@hexiaz.com>2014-05-08 21:02:25 +0800
committerFuXiaoHei <fuxiaohei@hexiaz.com>2014-05-08 21:02:25 +0800
commit8eb15815f18dcef0ded3f15835b4f1eadf9335d9 (patch)
tree376e0d32f09863d77521cf4af82a1fa90ce0e045 /models/action.go
parent11ca10ab2fa9c0e0c8036d33bd31f4815ceb490e (diff)
parent23a857d107b06b5639b337aba2e335d3d66ef9db (diff)
Merge remote-tracking branch 'origin/dev' into dev
Diffstat (limited to 'models/action.go')
-rw-r--r--models/action.go24
1 files changed, 21 insertions, 3 deletions
diff --git a/models/action.go b/models/action.go
index ef9e260a..02639e55 100644
--- a/models/action.go
+++ b/models/action.go
@@ -114,6 +114,10 @@ func CommitRepoAction(userId, repoUserId int64, userName, actEmail string,
qlog.Info("action.CommitRepoAction(end): %d/%s", repoUserId, repoName)
// New push event hook.
+ if err := repo.GetOwner(); err != nil {
+ return errors.New("action.CommitRepoAction(GetOwner): " + err.Error())
+ }
+
ws, err := GetActiveWebhooksByRepoId(repoId)
if err != nil {
return errors.New("action.CommitRepoAction(GetWebhooksByRepoId): " + err.Error())
@@ -121,12 +125,13 @@ func CommitRepoAction(userId, repoUserId int64, userName, actEmail string,
return nil
}
+ repoLink := fmt.Sprintf("%s%s/%s", base.AppUrl, repoUserName, repoName)
commits := make([]*hooks.PayloadCommit, len(commit.Commits))
for i, cmt := range commit.Commits {
commits[i] = &hooks.PayloadCommit{
Id: cmt.Sha1,
Message: cmt.Message,
- Url: fmt.Sprintf("%s%s/%s/commit/%s", base.AppUrl, repoUserName, repoName, cmt.Sha1),
+ Url: fmt.Sprintf("%s/commit/%s", repoLink, cmt.Sha1),
Author: &hooks.PayloadAuthor{
Name: cmt.AuthorName,
Email: cmt.AuthorEmail,
@@ -136,9 +141,22 @@ func CommitRepoAction(userId, repoUserId int64, userName, actEmail string,
p := &hooks.Payload{
Ref: refFullName,
Commits: commits,
+ Repo: &hooks.PayloadRepo{
+ Id: repo.Id,
+ Name: repo.LowerName,
+ Url: repoLink,
+ Description: repo.Description,
+ Website: repo.Website,
+ Watchers: repo.NumWatches,
+ Owner: &hooks.PayloadAuthor{
+ Name: repoUserName,
+ Email: actEmail,
+ },
+ Private: repo.IsPrivate,
+ },
Pusher: &hooks.PayloadAuthor{
- Name: userName,
- Email: actEmail,
+ Name: repo.Owner.LowerName,
+ Email: repo.Owner.Email,
},
}