diff options
author | Unknown <joe2010xtmf@163.com> | 2014-03-13 02:39:09 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-03-13 02:39:09 -0400 |
commit | 27104ac89a4c489809068ae5c6dbe383ce7fbde2 (patch) | |
tree | 2f19eeecc08209285d9aee53c0c224a4fd8967d3 /routers | |
parent | 18ba14913746c6c436c4632bdc9174ecfcd59dda (diff) | |
download | gitea-27104ac89a4c489809068ae5c6dbe383ce7fbde2.tar.gz gitea-27104ac89a4c489809068ae5c6dbe383ce7fbde2.zip |
Add delete repo
Diffstat (limited to 'routers')
-rw-r--r-- | routers/repo/repo.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/routers/repo/repo.go b/routers/repo/repo.go index 5769aff7c3..a12b45d7b9 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -5,9 +5,9 @@ package repo import ( - "net/http" "github.com/martini-contrib/render" "github.com/martini-contrib/sessions" + "net/http" "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" @@ -68,7 +68,7 @@ func Create(form auth.CreateRepoForm, req *http.Request, r render.Render, data b r.HTML(200, "base/error", data) } -func Delete(req *http.Request, r render.Render, data base.TmplData, session sessions.Session) { +func Delete(form auth.DeleteRepoForm, req *http.Request, r render.Render, data base.TmplData, session sessions.Session) { data["Title"] = "Delete repository" if req.Method == "GET" { @@ -76,13 +76,14 @@ func Delete(req *http.Request, r render.Render, data base.TmplData, session sess return } - u := &models.User{} - err := models.DeleteRepository(u, "") - if err != nil { + if err := models.DeleteRepository(form.UserId, form.RepoId, form.UserName); err != nil { data["ErrorMsg"] = err log.Error("repo.Delete: %v", err) r.HTML(200, "base/error", data) + return } + + r.Redirect("/", 200) } func List(req *http.Request, r render.Render, data base.TmplData, session sessions.Session) { |