diff options
author | Unknown <joe2010xtmf@163.com> | 2014-06-08 04:45:34 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-06-08 04:45:34 -0400 |
commit | 302c863cda651130286838309d3d897cace93534 (patch) | |
tree | bc2b5e8efd513304806e1e900141856d3adfce48 /models/action.go | |
parent | a0318db2f9094eda2beea19ed323244b4ae30831 (diff) | |
download | gitea-302c863cda651130286838309d3d897cace93534.tar.gz gitea-302c863cda651130286838309d3d897cace93534.zip |
Fix #242
Diffstat (limited to 'models/action.go')
-rw-r--r-- | models/action.go | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/models/action.go b/models/action.go index 9fc9d89b9f..e39b04a1ad 100644 --- a/models/action.go +++ b/models/action.go @@ -15,7 +15,6 @@ import ( qlog "github.com/qiniu/log" "github.com/gogits/gogs/modules/base" - "github.com/gogits/gogs/modules/hooks" "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/setting" ) @@ -131,35 +130,35 @@ func CommitRepoAction(userId, repoUserId int64, userName, actEmail string, } repoLink := fmt.Sprintf("%s%s/%s", setting.AppUrl, repoUserName, repoName) - commits := make([]*hooks.PayloadCommit, len(commit.Commits)) + commits := make([]*PayloadCommit, len(commit.Commits)) for i, cmt := range commit.Commits { - commits[i] = &hooks.PayloadCommit{ + commits[i] = &PayloadCommit{ Id: cmt.Sha1, Message: cmt.Message, Url: fmt.Sprintf("%s/commit/%s", repoLink, cmt.Sha1), - Author: &hooks.PayloadAuthor{ + Author: &PayloadAuthor{ Name: cmt.AuthorName, Email: cmt.AuthorEmail, }, } } - p := &hooks.Payload{ + p := &Payload{ Ref: refFullName, Commits: commits, - Repo: &hooks.PayloadRepo{ + Repo: &PayloadRepo{ Id: repo.Id, Name: repo.LowerName, Url: repoLink, Description: repo.Description, Website: repo.Website, Watchers: repo.NumWatches, - Owner: &hooks.PayloadAuthor{ + Owner: &PayloadAuthor{ Name: repoUserName, Email: actEmail, }, Private: repo.IsPrivate, }, - Pusher: &hooks.PayloadAuthor{ + Pusher: &PayloadAuthor{ Name: repo.Owner.LowerName, Email: repo.Owner.Email, }, @@ -172,7 +171,13 @@ func CommitRepoAction(userId, repoUserId int64, userName, actEmail string, } p.Secret = w.Secret - hooks.AddHookTask(&hooks.HookTask{hooks.HTT_WEBHOOK, w.Url, p, w.ContentType, w.IsSsl}) + CreateHookTask(&HookTask{ + Type: WEBHOOK, + Url: w.Url, + Payload: p, + ContentType: w.ContentType, + IsSsl: w.IsSsl, + }) } return nil } |