diff options
author | Unknwon <u@gogs.io> | 2015-07-25 21:32:04 +0800 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-07-25 21:32:04 +0800 |
commit | fa298a2c30c358dbfa47fc123c6aca83fe9eb999 (patch) | |
tree | 2179828e8b7c8ebafe3121506f26d52cb0350c63 /routers | |
parent | 2b1442f3dfa3558f4e1a9dd5b1dbb50cf348e6e0 (diff) | |
download | gitea-fa298a2c30c358dbfa47fc123c6aca83fe9eb999.tar.gz gitea-fa298a2c30c358dbfa47fc123c6aca83fe9eb999.zip |
#835: Realtime webhooks
Diffstat (limited to 'routers')
-rw-r--r-- | routers/install.go | 1 | ||||
-rw-r--r-- | routers/repo/http.go | 5 | ||||
-rw-r--r-- | routers/repo/setting.go | 4 |
3 files changed, 9 insertions, 1 deletions
diff --git a/routers/install.go b/routers/install.go index 055c1ccd8e..58c38c3122 100644 --- a/routers/install.go +++ b/routers/install.go @@ -68,6 +68,7 @@ func GlobalInit() { models.HasEngine = true cron.NewCronContext() + models.InitDeliverHooks() log.NewGitLogger(path.Join(setting.LogRootPath, "http.log")) } if models.EnableSQLite3 { diff --git a/routers/repo/http.go b/routers/repo/http.go index 8395d1c041..4e5aba04e0 100644 --- a/routers/repo/http.go +++ b/routers/repo/http.go @@ -190,7 +190,10 @@ func Http(ctx *middleware.Context) { refName := fields[2] // FIXME: handle error. - models.Update(refName, oldCommitId, newCommitId, authUsername, username, reponame, authUser.Id) + if err = models.Update(refName, oldCommitId, newCommitId, authUsername, username, reponame, authUser.Id); err == nil { + models.HookQueue.AddRepoID(repo.Id) + } + } lastLine = lastLine + size } else { diff --git a/routers/repo/setting.go b/routers/repo/setting.go index 756f297925..c371480816 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -634,3 +634,7 @@ func GitHooksEditPost(ctx *middleware.Context) { } ctx.Redirect(ctx.Repo.RepoLink + "/settings/hooks/git") } + +func TriggerHook(ctx *middleware.Context) { + models.HookQueue.AddRepoID(ctx.Repo.Repository.Id) +} |