summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2014-03-29 14:35:54 +0800
committerLunny Xiao <xiaolunwen@gmail.com>2014-03-29 14:35:54 +0800
commitf48fc24670b122df069149801459eb55a67045c7 (patch)
tree04a054e989341953072f854134a50d62f75993c8 /routers
parente085d7738a683785a5d7d7e3a33a0437c87c340b (diff)
parentd01820c125669367b7a585d767d5f11e73a701c2 (diff)
downloadgitea-f48fc24670b122df069149801459eb55a67045c7.tar.gz
gitea-f48fc24670b122df069149801459eb55a67045c7.zip
Merge branch 'master' of github.com:gogits/gogs
Diffstat (limited to 'routers')
-rw-r--r--routers/admin/admin.go1
-rw-r--r--routers/install.go28
-rw-r--r--routers/repo/issue.go23
3 files changed, 39 insertions, 13 deletions
diff --git a/routers/admin/admin.go b/routers/admin/admin.go
index 0b5e3d8e7d..f303439fd1 100644
--- a/routers/admin/admin.go
+++ b/routers/admin/admin.go
@@ -141,7 +141,6 @@ func Config(ctx *middleware.Context) {
ctx.Data["Domain"] = base.Domain
ctx.Data["RunUser"] = base.RunUser
ctx.Data["RunMode"] = strings.Title(martini.Env)
- ctx.Data["EnableHttpsClone"] = base.EnableHttpsClone
ctx.Data["RepoRootPath"] = base.RepoRootPath
ctx.Data["Service"] = base.Service
diff --git a/routers/install.go b/routers/install.go
index d7d5159efc..b5c3a9364b 100644
--- a/routers/install.go
+++ b/routers/install.go
@@ -4,10 +4,30 @@
package routers
-import "github.com/gogits/gogs/modules/middleware"
+import (
+ "errors"
+
+ "github.com/gogits/gogs/models"
+ "github.com/gogits/gogs/modules/auth"
+ "github.com/gogits/gogs/modules/base"
+ "github.com/gogits/gogs/modules/middleware"
+)
+
+func Install(ctx *middleware.Context, form auth.InstallForm) {
+ if base.InstallLock {
+ ctx.Handle(404, "install.Install", errors.New("Installation is prohibited"))
+ return
+ }
-func Install(ctx *middleware.Context){
- ctx.Data["PageIsInstall"] = true
ctx.Data["Title"] = "Install"
- ctx.HTML(200,"install")
+ ctx.Data["DbCfg"] = models.DbCfg
+ ctx.Data["RepoRootPath"] = base.RepoRootPath
+ ctx.Data["RunUser"] = base.RunUser
+ ctx.Data["AppUrl"] = base.AppUrl
+ ctx.Data["PageIsInstall"] = true
+
+ if ctx.Req.Method == "GET" {
+ ctx.HTML(200, "install")
+ return
+ }
}
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index 77e35bbae6..6ac8a53579 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -40,9 +40,7 @@ func Issues(ctx *middleware.Context) {
ctx.Redirect("/user/login/", 302)
return
}
- posterId = ctx.User.Id
ctx.Data["ViewType"] = "created_by"
- ctx.Data["IssueCreatedCount"] = models.GetUserIssueCount(posterId, ctx.Repo.Repository.Id)
}
// Get issues.
@@ -53,6 +51,11 @@ func Issues(ctx *middleware.Context) {
return
}
+ if ctx.IsSigned {
+ posterId = ctx.User.Id
+ }
+ var createdByCount int
+
// Get posters.
for i := range issues {
u, err := models.GetUserById(issues[i].PosterId)
@@ -61,12 +64,16 @@ func Issues(ctx *middleware.Context) {
return
}
issues[i].Poster = u
+ if u.Id == posterId {
+ createdByCount++
+ }
}
ctx.Data["Issues"] = issues
ctx.Data["IssueCount"] = ctx.Repo.Repository.NumIssues
ctx.Data["OpenCount"] = ctx.Repo.Repository.NumIssues - ctx.Repo.Repository.NumClosedIssues
ctx.Data["ClosedCount"] = ctx.Repo.Repository.NumClosedIssues
+ ctx.Data["IssueCreatedCount"] = createdByCount
ctx.Data["IsShowClosed"] = ctx.Query("state") == "closed"
ctx.HTML(200, "issue/list")
}
@@ -224,6 +231,12 @@ func Comment(ctx *middleware.Context, params martini.Params) {
return
}
+ content := ctx.Query("content")
+ if len(content) == 0 {
+ ctx.Redirect(fmt.Sprintf("/%s/%s/issues/%d", ctx.User.Name, ctx.Repo.Repository.Name, index))
+ return
+ }
+
issue, err := models.GetIssueByIndex(ctx.Repo.Repository.Id, int64(index))
if err != nil {
if err == models.ErrIssueNotExist {
@@ -234,12 +247,6 @@ func Comment(ctx *middleware.Context, params martini.Params) {
return
}
- content := ctx.Query("content")
- if len(content) == 0 {
- ctx.Handle(404, "issue.Comment", err)
- return
- }
-
switch params["action"] {
case "new":
if err = models.CreateComment(ctx.User.Id, issue.Id, 0, 0, content); err != nil {