]> source.dussan.org Git - gitea.git/commitdiff
Finish delete user
authorUnknown <joe2010xtmf@163.com>
Tue, 11 Mar 2014 15:40:47 +0000 (11:40 -0400)
committerUnknown <joe2010xtmf@163.com>
Tue, 11 Mar 2014 15:40:47 +0000 (11:40 -0400)
README.md
gogs.go
models/user.go
routers/user/user.go
templates/user/delete.tmpl
wercker.yml [new file with mode: 0644]

index c1f7b3d6b869c8d47c10688b8f30fe60b78ef4f4..ef7ccec449ea810112d30d8f190a1682c02d1e7b 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
-Gogs - Go Git Service [![Go Walker](http://gowalker.org/api/v1/badge)](https://gowalker.org/github.com/gogits/gogs)
+Gogs - Go Git Service [![wercker status](https://app.wercker.com/status/ad0bdb0bc450ac6f09bc56b9640a50aa/s/ "wercker status")](https://app.wercker.com/project/bykey/ad0bdb0bc450ac6f09bc56b9640a50aa) [![Go Walker](http://gowalker.org/api/v1/badge)](https://gowalker.org/github.com/gogits/gogs)
 =====================
 
-Gogs(Go Git Service) is a GitHub-like clone in the Go Programming Language.
+Gogs(Go Git Service) is a GitHub-like clone in the Go Programming Language, it currently supports Linux and Max OS X, but Windows has **NOT** supported yet due to installation problem with [libgit2](http://libgit2.github.com/) in Windows.
 
 ## Purpose
 
@@ -9,14 +9,14 @@ There are some very good products in this category such as [gitlab](http://gitla
 
 ## Overview
 
-Please see [Wiki](https://github.com/gogits/gogs/wiki) for project design.
+Please see [Wiki](https://github.com/gogits/gogs/wiki) for project design, develop specification, change log and road map.
 
 ## Installation
 
-### Dependencies
+There are two ways to install Gogs:
 
-- [Go Programming Language](http://golang.org): Main develop language.
-- [libgit2](http://libgit2.github.com/)(cgo): Git data manipulation.
+- [Install from binary](https://github.com/gogits/gogs/wiki/Install-from-binary)
+- [Install from source](https://github.com/gogits/gogs/wiki/Install-from-source)
 
 ## Acknowledgments
 
diff --git a/gogs.go b/gogs.go
index 0bdf74d720b3e04c103e4eddc7740736c1ea7721..cf097a3a0ff6d171d9b42bcb8e1929911cf05228 100644 (file)
--- a/gogs.go
+++ b/gogs.go
@@ -20,7 +20,7 @@ import (
 // Test that go1.1 tag above is included in builds. main.go refers to this definition.
 const go11tag = true
 
-const APP_VER = "0.0.4.0311"
+const APP_VER = "0.0.5.0311"
 
 func init() {
        runtime.GOMAXPROCS(runtime.NumCPU())
index 05169e46996398ba18873a32b00a7fd3d21fd457..8fa2e44e009ae9273f745309bd28efe1f3e5654b 100644 (file)
@@ -150,10 +150,10 @@ func UpdateUser(user *User) (err error) {
 
 // DeleteUser completely deletes everything of the user.
 func DeleteUser(user *User) error {
-       cnt, err := GetRepositoryCount(user)
+       count, err := GetRepositoryCount(user)
        if err != nil {
                return errors.New("modesl.GetRepositories: " + err.Error())
-       } else if cnt > 0 {
+       } else if count > 0 {
                return ErrUserOwnRepos
        }
 
index 7a58ba57fb075559f091191a85e7029954a349c8..5017e878c687f12e7f3d59054a2ada53fb17c009 100644 (file)
@@ -151,8 +151,18 @@ func Delete(data base.TmplData, req *http.Request, session sessions.Session, r r
 
        id := auth.SignedInId(session)
        u := &models.User{Id: id}
-       err := models.DeleteUser(u)
-       data["ErrorMsg"] = err
-       log.Error("user.Delete: %v", data)
-       r.HTML(200, "base/error", nil)
+       if err := models.DeleteUser(u); err != nil {
+               data["HasError"] = true
+               switch err.Error() {
+               case models.ErrUserOwnRepos.Error():
+                       data["ErrorMsg"] = "Your account still have ownership of repository, you have to delete or transfer them first."
+               default:
+                       data["ErrorMsg"] = err
+                       log.Error("user.Delete: %v", data)
+                       r.HTML(200, "base/error", nil)
+                       return
+               }
+       }
+
+       r.HTML(200, "user/delete", data)
 }
index e6522aa21d1b9482a031d97819472c6071be5ebf..af0e1fbc06924c38d7c8a5c2814e3d000d0ff64b 100644 (file)
@@ -15,7 +15,7 @@
     <div id="gogs-user-setting-container" class="col-md-9">
         <form action="/user/delete" method="post" class="form-horizontal" id="gogs-user-delete">
             <h4>Delete Account</h4>
-            <p class="alert alert-danger">Deleting your account is permanent. Sorry to see you go, if you have any feedback you can contact us.</p>
+            <p class="alert alert-danger">{{if not .HasError}}The operation will delete your account permanently. Sorry to see you go, but we know you'll back soon.{{else}}{{.ErrorMsg}}{{end}}</p>
             <div class="form-group">
                 <div class="col-md-3">
                     <button type="submit" class="btn btn-danger btn-lg">Delete Account</button>
diff --git a/wercker.yml b/wercker.yml
new file mode 100644 (file)
index 0000000..7c64bf0
--- /dev/null
@@ -0,0 +1 @@
+box: wercker/default