summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/http.go11
-rw-r--r--routers/repo/issue.go8
-rw-r--r--routers/user/profile.go2
3 files changed, 14 insertions, 7 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
}
diff --git a/routers/user/profile.go b/routers/user/profile.go
index 46c2688d27..d0f41262d1 100644
--- a/routers/user/profile.go
+++ b/routers/user/profile.go
@@ -75,7 +75,7 @@ func Profile(ctx *middleware.Context) {
ctx.Data["PageIsUserProfile"] = true
ctx.Data["Owner"] = u
- orgs, err := models.GetOrgsByUserIDDesc(u.Id, "updated", ctx.User.IsAdmin || ctx.User.Id == u.Id)
+ orgs, err := models.GetOrgsByUserID(u.Id, ctx.IsSigned && (ctx.User.IsAdmin || ctx.User.Id == u.Id))
if err != nil {
ctx.Handle(500, "GetOrgsByUserIDDesc", err)
return