diff options
Diffstat (limited to 'routers/repo')
-rw-r--r-- | routers/repo/http.go | 11 | ||||
-rw-r--r-- | routers/repo/issue.go | 8 |
2 files changed, 13 insertions, 6 deletions
diff --git a/routers/repo/http.go b/routers/repo/http.go index 5e81e73cec..f9600c94de 100644 --- a/routers/repo/http.go +++ b/routers/repo/http.go @@ -134,7 +134,6 @@ func HTTP(ctx *middleware.Context) { ctx.Handle(500, "GetUserByID", err) return } - authUsername = authUser.Name } if !isPublicPull { @@ -202,7 +201,15 @@ func HTTP(ctx *middleware.Context) { refName := fields[2] // FIXME: handle error. - if err = models.Update(refName, oldCommitId, newCommitId, authUsername, username, reponame, authUser.Id); err == nil { + if err = models.PushUpdate(models.PushUpdateOptions{ + RefName: refName, + OldCommitID: oldCommitId, + NewCommitID: newCommitId, + PusherID: authUser.Id, + PusherName: authUser.Name, + RepoUserName: username, + RepoName: reponame, + }); err == nil { go models.HookQueue.Add(repo.ID) go models.AddTestPullRequestTask(repo.ID, strings.TrimPrefix(refName, "refs/heads/")) } diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 3120a8ba27..1d747d2f7e 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -57,9 +57,9 @@ func MustEnableIssues(ctx *middleware.Context) { } } -func MustEnablePulls(ctx *middleware.Context) { - if !ctx.Repo.Repository.EnablePulls { - ctx.Handle(404, "MustEnablePulls", nil) +func MustAllowPulls(ctx *middleware.Context) { + if !ctx.Repo.Repository.AllowsPulls() { + ctx.Handle(404, "MustAllowPulls", nil) } ctx.Data["HasForkedRepo"] = ctx.IsSigned && ctx.User.HasForkedRepo(ctx.Repo.Repository.ID) @@ -81,7 +81,7 @@ func RetrieveLabels(ctx *middleware.Context) { func Issues(ctx *middleware.Context) { isPullList := ctx.Params(":type") == "pulls" if isPullList { - MustEnablePulls(ctx) + MustAllowPulls(ctx) if ctx.Written() { return } |